[libcxx-commits] [PATCH] D127130: [libc++] Implement ranges::lexicographical_compare

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 13 21:54:32 PDT 2022


philnik marked an inline comment as done.
philnik added inline comments.


================
Comment at: libcxx/test/std/algorithms/alg.sorting/alg.lex.comparison/ranges.lexicographical_compare.pass.cpp:189
+      int a[] = {1, 2, 3, 4, 5};
+      auto ret = std::ranges::lexicographical_compare(std::begin(a), std::end(a), std::begin(a), std::end(a), pred, proj1, proj2);
+      assert(!ret);
----------------
var-const wrote:
> philnik wrote:
> > var-const wrote:
> > > Question: why is `std::begin` necessary here?
> > It's not necessary, but I think `std::begin` and `std::end` should always go together. It is just another thing you have to think about otherwise.
> Sorry, what I meant was, why not just use `(a, a + 5, a, a + 5, red, proj1, proj2)`?
@Mordante requested this change on another review and I agree with him that `std::begin(a), std::end(a)` is much easier to digest than `a, a + 5`. It's just correct on sight.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127130



More information about the libcxx-commits mailing list