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++/86127] STL containers do not satisfy container.requirements.general clause 8


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

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Wed Jul  4 11:46:43 2018
New Revision: 262393

URL: https://gcc.gnu.org/viewcvs?rev=262393&root=gcc&view=rev
Log:
PR libstdc++/86127 avoid unnecessary allocator conversions

There is no need to use an allocator of the correct value_type when
calling allocator_traits::construct and allocator_traits::destroy. The
existing node allocator can be used, instead of constructing a new
allocator object every time.

There's also no benefit to using __gnu_cxx::__alloc_traits instead of
std::allocator_traits to get the pointer and const_pointer types.
std::forward_list is only available for C++11 and later, when
std::allocator_traits is available too.

Backport from mainline
2018-06-13  Jonathan Wakely  <jwakely@redhat.com>

        PR libstdc++/86127
        * include/bits/forward_list.h (_Fwd_list_base::_Tp_alloc_type): Remove
        unused typedef.
        (_Fwd_list_base::_M_create_node, _Fwd_list_base::_M_erase_after):
        Use node allocator to create and destroy elements.
        (forward_list::_Tp_alloc_type): Remove unused typedef.
        (forward_list::_Alloc_traits): Use allocator_traits instead of
        __gnu_cxx::__alloc_traits.

Modified:
    branches/gcc-8-branch/libstdc++-v3/ChangeLog
    branches/gcc-8-branch/libstdc++-v3/include/bits/forward_list.h
    branches/gcc-8-branch/libstdc++-v3/include/bits/forward_list.tcc

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