[libcxx-commits] [PATCH] D150831: [libc++] Implement ranges::ends_with

Zijun Zhao via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 2 12:09:26 PDT 2023


ZijunZhao added inline comments.


================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/alg.ends_with/ranges.ends_with.pass.cpp:179
+   Iter1(a), Sent1(Iter1(a + 6)), Iter2(p), Sent2(Iter2(p + 2)), [](int l, int r) { return l > r; });
+   assert(!ret);
+  }
----------------
var-const wrote:
> But this wouldn't return `true` using the default predicate either, right? In general, for these checks it's better to supply a predicate such that the algorithm returns `true` with the custom predicate but `false` otherwise (since there's only one way the algorithm could return true but many ways it could return false, this check is more specific).
I see! I will change the test and make sure only one variable (control variables). Good catch!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150831



More information about the libcxx-commits mailing list