[PATCH] Avoid allocator operator== in _Safe_container

François Dumont frs.dumont@gmail.com
Mon Aug 9 10:23:55 GMT 2021


Some newly introduced tests in 
23_containers/unordered_map/cons/default.cc revealed that we are forcing 
the allocator type to have a operator==.

It can be avoided by checking allocator_traits::is_always_equal.

     libstdc++: [_GLIBCXX_DEBUG] Avoid allocator operator== when always 
equal

     Use std::allocator_traits::is_always_equal to find out if we need 
to compare
     allocator instances on safe container allocator aware move constructor.

     libstdc++-v3/ChangeLog:

             * include/debug/safe_container.h
             (_Safe_container(_Safe_container&&, const _Alloc&, 
std::true_type)): New.
             (_Safe_container(_Safe_container&&, const _Alloc&, 
std::false_type)): New.
             (_Safe_container(_Safe_container&&, const _Alloc&)): Use 
latters.

Tested under Linux x86 Debug mode.

Ok to commit ?

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: safe_container.patch
Type: text/x-patch
Size: 1095 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20210809/efe525da/attachment.bin>


More information about the Libstdc++ mailing list