[libcxx-commits] [PATCH] D61878: Change how containers are compared

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 16 11:04:33 PDT 2019


ldionne requested changes to this revision.
ldionne added inline comments.
This revision now requires changes to proceed.
Herald added a subscriber: dexonsmith.


================
Comment at: benchmarks/unordered_set_comp.bench.cpp:82
+bool
+new_comp(const std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+         const std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
----------------
This should be extracted into an implementation-detail function and used in both the headers and this benchmark, instead of copy-pasting.


================
Comment at: include/unordered_set:1535
+    auto __first2 = __y.begin();
+    for (; __first1 != __last1; ++__first1, (void) ++__first2)
+        if (!(*__first1 == *__first2))
----------------
That's basically equivalent to:

```
bool res = std::equal(__first1, __last1, __first2);
if (res)
  return true;

// rest of the code after __not_done label
```

Or did I miss something? If they're equivalent, I suggest we remove the raw loop.


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D61878





More information about the libcxx-commits mailing list