aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorFrançois Dumont <fdumont@gcc.gnu.org>2020-01-16 08:34:21 +0000
committerJonathan Wakely <jwakely@redhat.com>2020-01-16 14:39:05 +0000
commitd916538965ea260c6bcdb1d46581f6d572017ce8 (patch)
tree59517c6575a40c8df9eb7d343fb009c7cc7de1fe /gcc
parent8c197c851e7528baba7cb837f34c05ba2242f705 (diff)
downloadgcc-d916538965ea260c6bcdb1d46581f6d572017ce8.zip
gcc-d916538965ea260c6bcdb1d46581f6d572017ce8.tar.gz
gcc-d916538965ea260c6bcdb1d46581f6d572017ce8.tar.bz2
libstdc++: Improve unordered containers == operator (PR 91263)
Avoid comparing elements with operator== multiple times by replacing uses of find and equal_range with equivalent inlined code that uses operator== instead of the container's equality comparison predicate. This is valid because the standard requires that operator== is a refinement of the equality predicate. Also replace the _S_is_permutation function with std::is_permutation, which wasn't yet implemented when this code was first written. PR libstdc++/91263 * include/bits/hashtable.h (_Hashtable<>): Make _Equality<> friend. * include/bits/hashtable_policy.h: Include <bits/stl_algo.h>. (_Equality_base): Remove. (_Equality<>::_M_equal): Review implementation. Use std::is_permutation. * testsuite/23_containers/unordered_multiset/operators/1.cc (Hash, Equal, test02, test03): New. * testsuite/23_containers/unordered_set/operators/1.cc (Hash, Equal, test02, test03): New.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions