[libcxx-commits] [PATCH] D61771: Comparing Unordered Containers (P0809)

Marshall Clow via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 10 07:20:02 PDT 2019


mclow.lists added inline comments.


================
Comment at: include/unordered_map:1641
+#if _LIBCPP_STD_VER > 17
+template <class _Key, class _Tp, class _Hash1, class _Pred, class _Alloc1,
+                                 class _Hash2,              class _Alloc2>
----------------
zoecarver wrote:
> Was it ever necessary for the two maps to use the same allocator type (and is it now)? Furthermore, is it even necessary for them to have the same key/value type (I don't see anything in the standard that explicitly says they need to be)? 
All the container comparisons in the standard are defined in terms of comparing two containers of the same type. For allocator-aware containers, this includes the allocators.  There is a proposal to relax that in flight (https://wg21.link/P0805), but I don't think that will be part of C++20.

My suggestion is to not support heterogenous comparisons at this time.
Note that this includes the hasher as well as the predicate and the allocator.


================
Comment at: test/std/containers/unord/unord.map/comp_different_hash.pass.cpp:34
+
+template<class Map, class Itter>
+void fill(Map& map, Itter begin, Itter end)
----------------
I don't think that this is what P0809 meant.  "Hashes with different behavior", yes.
"Hashes of different types", no.



Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61771/new/

https://reviews.llvm.org/D61771





More information about the libcxx-commits mailing list