]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR libstdc++/86127 avoid unnecessary allocator conversions
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Jun 2018 15:14:48 +0000 (15:14 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Jun 2018 15:14:48 +0000 (15:14 +0000)
commitef00e9947f77f2dfdf4a459b70bd7a0fafb8818d
treee7c88fc2dfec795bd2110d8e2b6ea279fe0daf89
parent2ff6865eb1829ad02206fd8068e868d65faf087b
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.

PR libstdc++/86127
* include/bits/forward_list.h (_Fwd_list_base::_Tp_alloc_type): Remove
unused typedef.
(_Fwd_list_base::_Node_alloc_traits): Use allocator_traits instead of
__gnu_cxx::__alloc_traits.
(_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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261554 138bc75d-0d04-0410-961f-82ee72b054a4
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/forward_list.h
libstdc++-v3/include/bits/forward_list.tcc