[PATCH] PR libstdc++/92124 on hashtable

François Dumont frs.dumont@gmail.com
Thu Nov 7 19:28:00 GMT 2019

 From what I understood from recent fix the unordered containers need to 
be updated the same way.

I hope you'll appreciate the usage of rvalue forwarding. Containers node 
values are moved as soon as _M_assign is called with a rvalue reference 
to the source container.

Additionnaly this patch removes usages of lambdas in _Hashtable.

If you confirm it I'll check for the same on _Rb_tree.

     * include/bits/hashtable.h (_Hashtable<>::__alloc_node_gen_t): New
     template alias.
     (_Hashtable<>::__mv_if_value_type_mv_noexcept): New.
     (_Hashtable<>::__fwd_value): New.
     (_Hashtable<>::_M_assign_elements<>): Remove _NodeGenerator template
     (_Hashtable<>::_M_assign<>): Add _Ht template parameter.
     (_Hashtable<>::operator=(const _Hashtable<>&)): Adapt.
     (_Hashtable<>::_M_move_assign): Adapt.
     (_Hashtable<>::_Hashtable(const _Hashtable&)): Adapt.
     (_Hashtable<>::_Hashtable(const _Hashtable&, const allocator_type&)):
     (_Hashtable<>::_Hashtable(_Hashtable&&, const allocator_type&)):
     * testsuite/23_containers/unordered_set/92124.cc: New.

Tested under Linux x86_64.

Ok to commit ?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: hashtable_92124.patch
Type: text/x-patch
Size: 8927 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20191107/6339a421/attachment.bin>

More information about the Libstdc++ mailing list