This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug libstdc++/64865] std::allocator::construct/destroy not called for specialization of std::allocator<trivialtype>


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64865

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to TC from comment #2)
> Since the allocator_type member must be the Alloc template argument provided
> by the user and not any rebound types, though,

N.B. libstdc++ supports std::vector<int, std::allocator<char>> and so always
rebinds the _Alloc parameter to get an allocator for the value_type. That
doesn't change your argument though, because it will rebind it to
allocator<value_type> and that's  the type that's specialized.

> it seems to me that it is in
> fact guaranteed that their versions of construct() and destroy() will be
> called, as the paragraph you cite requires the use of
> allocator_traits<allocator_type>::construct and
> allocator_traits<allocator_type>::destroy.

That's a defect, see http://cplusplus.github.io/LWG/lwg-active.html#2218

That defect is a problem for node-based containers, but in principle any
container should be able to use
allocator_traits<allocator_type>::rebind_traits<SomeInternalType>::construct()
to construct the elements, in which case your allocator<value_type>
specialization is not used.


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