Created on 2010-08-25.00:00:00 last changed 161 months ago
Proposed resolution:
In [allocator.requirements], Table 42, change two rows as follows:
X::size_type unsigned integral type a type that can represent the size of the largest object in the allocation model size_tmake_unsigned<X::difference_type>::typeX::difference_type signed integral type a type that can represent the difference between any two pointers in the allocation model ptrdiff_tpointer_traits<X::pointer>::difference_type
In [allocator.traits.types], Change the definition of difference_type and size_type as follows:
typedef see below difference_type;
Type: Alloc::difference_type if such a type exists, else
ptrdiff_tpointer_traits<pointer>::difference_type.typedef see below size_type;
Type: Alloc::size_type if such a type exists, else
size_tmake_unsigned<difference_type>::type.
[ Adopted at 2010-11 Batavia ]
[ Post-Rapperswil, Pablo provided wording: ]
The original ballot comment reads simply: "pointer_traits should have a size_type for completeness." The additional details reveal, however, that the desire for a size_type is actually driven by the needs of allocator_traits. The allocator_traits template should get its default difference_type from pointer_traits but if it did, it should get its size_type from the same source. Unfortunately, there is no obvious meaning for size_type in pointer_traits.
Alisdair suggested, however, that the natural relationship between difference_type and size_type can be expressed simply by the std::make_unsigned<T> metafunction. Using this metafunction, we can easily define size_type for allocator_traits without artificially adding size_type to pointer_traits.
Moved to Tentatively Ready after 6 positive votes on c++std-lib.
Addresses US-106
pointer_traits should have a size_type member for completeness.
Add typedef see below size_type; to the generic pointer_traits template and typedef size_t size_type; to pointer_traits<T*>. Use pointer_traits::size_type and pointer_traits::difference_type as the defaults for allocator_traits::size_type and allocator_traits::difference_type.
See Appendix 1 - Additional Details
History | |||
---|---|---|---|
Date | User | Action | Args |
2011-08-23 20:07:26 | admin | set | status: wp -> c++11 |
2010-11-23 13:22:14 | admin | set | messages: + msg5407 |
2010-11-14 13:10:57 | admin | set | status: voting -> wp |
2010-11-08 14:14:39 | admin | set | status: ready -> voting |
2010-10-21 19:47:27 | admin | set | messages: + msg4817 |
2010-10-21 19:47:27 | admin | set | messages: + msg4816 |
2010-08-25 00:00:00 | admin | create |