[libcxx-commits] [PATCH] D56498: [libcxx] Fix order checking in some more unordered_multimap tests.

Marshall Clow via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Apr 22 13:39:48 PDT 2019


mclow.lists added inline comments.


================
Comment at: test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp:48
+    }
+    assert(pos == end || pos->first != key);
+}
----------------
amakc11 wrote:
> mclow.lists wrote:
> > Shouldn't you also assert here that `s.empty()`?
> This assert looks redundant. The loop iterates `vsize = values.size()` (assuming `vsize > 0`) times and calls `values.erase()` the same number of times. So, by the end of the loop, the set `values` would be empty. However, by default, I will add the assert if you still insist.
Oh, I see. I was passing in a count of values; you're passing in a set of values, and "getting the count" from the set. My misunderstanding.

In that case, I would change the loop to be:
     while (!values.empty())



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

https://reviews.llvm.org/D56498





More information about the libcxx-commits mailing list