[PATCH] PR libstdc++/86127 avoid unnecessary allocator conversions
Jonathan Wakely
jwakely@redhat.com
Thu Jun 14 09:26:00 GMT 2018
On 14/06/18 07:45 +0200, François Dumont wrote:
>You're still using __gnu_cxx::__alloc_traits for
>_Fwd_list_base::_Node_alloc_traits to get the _S_always_equal().
>
>So you might perhaps cleanup this part of the ChangeLog entry.
Oops.
>Or make this true by making noexcept qualification dependent on the
>underlying constructors like I did for rb_tree:
>
>Â Â Â Â Â _Rb_tree(_Rb_tree&& __x, _Node_allocator&& __a)
>Â Â Â Â Â noexcept( noexcept(
>Â Â Â _Rb_tree(std::declval<_Rb_tree&&>(), std::declval<_Node_allocator&&>(),
>Â Â Â Â Â Â Â std::declval<typename _Alloc_traits::is_always_equal>())) )
It's also needed in forward_list.tcc for _S_propagate_on_copy_assign
and _S_always_equal which is why I kept it. But I fogot to update the
ChangeLog after deciding to keep it.
>On 13/06/2018 17:13, Jonathan Wakely wrote:
>>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.
>>
>>Tested powerpc64le-linux, committed to trunk.
>>
>>
>
More information about the Libstdc++
mailing list