Created on 2013-05-14.00:00:00 last changed 90 months ago
[ Drafting notes: if people prefer this to be normative, strip the "Note" markups. ]
Modify [container.requirements.general]/8 as indicated:
Unless otherwise specified, all containers defined in this clause obtain memory using an allocator (see [allocator.requirements]). [Note: In particular, containers and iterators do not store references to allocated elements other than through the allocator's pointer type, i.e., as objects of type P or pointer_traits<P>::template rebind<unspecified>, where P is allocator_traits<allocator_type>::pointer. — end note]
Proposed resolution:
This wording is relative to N4606.
[ 2016-08 Chicago ]
Tues PM: General agreement on direction, Alisdair and Billy to update wording
Fri AM: Moved to Tentatively Ready
[ 2016-08, Zhihao comments ]
The pointer types are not exposed in the container interface, and we consider that the memory allocation constraints "all containers defined in this clause obtain memory using an allocator" already implies the reasonable expectation. We propose the fix as non-normative.
Is a container C only supposed to refer to allocated memory (blocks of contiguous storage, nodes, etc.) through objects of type C::pointer rather than C::value_type*?
I don't see anything explicitly requiring this, so a container could immediately convert the result of get_allocator().allocate(1) to a built-in pointer of type value_type* and only deal with the built-in pointer until it needs to deallocate it again, but that removes most of the benefit of allowing allocators to use custom pointer types.
History | |||
---|---|---|---|
Date | User | Action | Args |
2017-07-30 20:15:43 | admin | set | status: wp -> c++17 |
2016-11-14 03:59:28 | admin | set | status: pending -> wp |
2016-11-14 03:55:22 | admin | set | status: ready -> pending |
2016-08-06 20:44:18 | admin | set | status: new -> ready |
2016-08-03 12:32:27 | admin | set | messages: + msg8354 |
2016-08-02 16:09:45 | admin | set | messages: + msg8317 |
2016-08-02 16:09:45 | admin | set | messages: + msg8316 |
2016-08-02 16:09:45 | admin | set | messages: + msg8315 |
2014-06-12 18:49:29 | admin | set | messages: + msg7024 |
2013-05-14 00:00:00 | admin | create |