[libcxx-commits] [PATCH] D122011: [libc++][ranges] Add implicit conversion to bool test for ranges::find{, if, if_not}

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 21 22:53:22 PDT 2022


var-const added inline comments.


================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/alg.find/ranges.find_if.pass.cpp:232
+      ImmobileBool a[] = {false, false, false, true};
+      auto ret = std::ranges::find_if(a, a + 4, [](const ImmobileBool& b) { return true == b; });
+      assert(ret == a + 3);
----------------
Can you add an explicit return type to make it clear that we're also testing that the algorithm supports predicates that return something convertible to `bool`, not just `bool`? (assuming I'm understanding the intention correctly) Applies to `find_if_not` as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122011



More information about the libcxx-commits mailing list