[libcxx-commits] [PATCH] D123681: [libc++] Implement ranges::equal

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 25 01:28:31 PDT 2022


philnik added inline comments.


================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/alg.equal/ranges.equal.pass.cpp:75
+    {
+      int a[] = {1, 2, 3, 4};
+      int b[] = {1, 2, 3, 4};
----------------
var-const wrote:
> var-const wrote:
> > Optional: a helper function would allow making the call sites quite a bit shorter:
> > ```
> > assert(test({1, 2, 3, 4}, {1, 2, 3, 4});
> > assert(test({1, 2, 3, 4}, {2, 3, 4, 5}, [](int l, int r) { return l != r; });
> > ...
> > // Comments can help distinguish parameters:
> > assert(test(/*a=*/ {1, 2, 3, 4}, /*b=*/ {2, 3, 4, 5}, /*pred=*/ [](int l, int r) { return l != r; });
> > ```
> Note: it's totally fine to ignore an optional suggestion, but in that case, please write a short comment to make it clear that you deliberately decided to not implement or postpone it. It would just make it more obvious to me whether you decided to not go with the suggestion or simply didn't get to this comment yet. Thanks!
I've done that in a few of the newly written code and I think it's nice. I might refactor the already-written tests later.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123681



More information about the libcxx-commits mailing list