[libcxx-commits] [PATCH] D112836: [libc++] Transparent unordered_foo::count() should use __count_multi.
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Oct 29 10:33:13 PDT 2021
Quuxplusone created this revision.
Quuxplusone added reviewers: rarutyun, mclow.lists, ldionne, libc++.
Quuxplusone added a project: libc++.
Quuxplusone requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++.
An `unordered_set` doesn't contain duplicates of the key_type, but it
may contain "duplicates" in the less-granular equivalence relationship
imposed by the transparent hasher/comparator on non-key_type objects.
The new tests are copied from the existing tests for `set` and `map`.
Thanks to Marshall Clow for highlighting this issue/use-case.
N.B.: I just copied the existing `count_transparent.pass.cpp` from `set`... but that gives us both Marshall's `count_transparent.pass.cpp` //and// Ruslan's `count.transparent.pass.cpp`. This is probably a terrible idea, so I'm open to suggestions for new test names.
It might also be a good idea for us to have a "neg test" proving that `m.insert({Tuple2{1,2}, 3})` does //not// use heterogeneous lookup — it deliberately converts `Tuple2` into `Tuple3` and then looks up the `Tuple3` according to the more granular equivalence relation.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D112836
Files:
libcxx/include/unordered_map
libcxx/include/unordered_set
libcxx/test/std/containers/associative/map/map.ops/count_transparent.pass.cpp
libcxx/test/std/containers/associative/map/map.ops/equal_range_transparent.pass.cpp
libcxx/test/std/containers/associative/set/count_transparent.pass.cpp
libcxx/test/std/containers/associative/set/equal_range_transparent.pass.cpp
libcxx/test/std/containers/unord/unord.map/count_transparent.pass.cpp
libcxx/test/std/containers/unord/unord.map/equal_range_transparent.pass.cpp
libcxx/test/std/containers/unord/unord.set/count_transparent.pass.cpp
libcxx/test/std/containers/unord/unord.set/equal_range_transparent.pass.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112836.383419.patch
Type: text/x-patch
Size: 14131 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211029/2449be6c/attachment.bin>
More information about the libcxx-commits
mailing list