This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

23.2.1 paragraph 3 and stl_tree.h


In my copy of a late draft of the 2011 C++ standard, 23.2.1 (General
container requirements) paragraph 3 reads:

"For the components affected by this subclause that declare an
allocator_type, objects stored in these
components shall be constructed using the
allocator_traits<allocator_type>::construct function and
destroyed using the allocator_traits<allocator_type>::destroy function
(20.6.8.2). These functions
are called only for the container's element type, not for internal
types used by the container. [ Note: This
means, for example, that a node-based container might need to
construct nodes containing aligned buffers
and call construct to place the element into the buffer. -- end note ]"

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf

As I read it, this applies to associative containers as well. However,
in stl_tree.h, _Rb_tree::_Node_allocator is defined on line 349 and
then used in _M_get_node() on line 385 using a type that is not the
container's element type, I think.

http://repo.or.cz/w/official-gcc.git/blob/7deb91c75a1c9de5bf46a5c959e5e709173ee639:/libstdc%2B%2B-v3/include/bits/stl_tree.h

Have I misinterpreted the standard or the library or both?

I noticed that status_cxx2011.xml mentions 23.2.1, saying "deque and
list do not meet the requirements relating to allocator use and
propagation":

http://repo.or.cz/w/official-gcc.git/blob/eeb171d3c9b90de3ba673d6951d0833282209933:/libstdc%2B%2B-v3/doc/xml/manual/status_cxx2011.xml

This makes me think that I may have interpreted the standard
differently that the authors of stl_tree.h.

Cheers,
Jim


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]