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

Zijun Zhao via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 23 17:12:59 PDT 2023


ZijunZhao added inline comments.


================
Comment at: libcxx/include/__algorithm/ranges_ends_with.h:81
+      _Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
+    auto __n1 = ranges::distance(__range1);
+    auto __n2 = ranges::distance(__range2);
----------------
var-const wrote:
> var-const wrote:
> > Can you just delegate to the non-range overload of `operator()`?
> I would strongly advise to do so unless there's a compelling reason not to. It's better to avoid code duplication when possible in these cases.
okay! I add a new helper function like `ranges_mismatch.h` to simplify code!


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