]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Use ADL swap for containers' function objects [PR117921]
authorJonathan Wakely <jwakely@redhat.com>
Thu, 5 Dec 2024 12:46:26 +0000 (12:46 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 5 Dec 2024 14:45:24 +0000 (14:45 +0000)
commit0368c42507328774cadbea589509b95aaf3cb826
tree9eb7beb3f16a651f927ad2739aa91d2f9e754be0
parent237fdf51fbfcfa4829471c18fe67535ae9c3efdb
libstdc++: Use ADL swap for containers' function objects [PR117921]

The standard says that Compare, Pred and Hash objects should be swapped
as described in [swappable.requirements] which means calling swap
unqualified with std::swap visible to name lookup.

libstdc++-v3/ChangeLog:

PR libstdc++/117921
* include/bits/hashtable_policy.h (_Hash_code_base::_M_swap):
Use ADL swap for Hash members.
(_Hashtable_base::_M_swap): Use ADL swap for _Equal members.
* include/bits/stl_tree.h (_Rb_tree::swap): Use ADL swap for
_Compare members.
* testsuite/23_containers/set/modifiers/swap/adl.cc: New test.
* testsuite/23_containers/unordered_set/modifiers/swap-2.cc: New
test.
libstdc++-v3/include/bits/hashtable_policy.h
libstdc++-v3/include/bits/stl_tree.h
libstdc++-v3/testsuite/23_containers/set/modifiers/swap/adl.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/unordered_set/modifiers/swap-2.cc [new file with mode: 0644]