[libcxx-commits] [PATCH] D123016: [libc++] Implement ranges::{all, any, none}_of

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 5 14:19:14 PDT 2022

var-const accepted this revision as: var-const.
var-const added a comment.

LGTM once the CI is green, but I'd wait for one other review before merging.

Comment at: libcxx/test/std/algorithms/alg.nonmodifying/alg.all_of/ranges.all_of.pass.cpp:30
+template <class It, class Sent = sentinel_wrapper<It>>
+concept HasAllOfIt = requires(It first, Sent last) { std::ranges::all_of(first, last, std::identity{}); };
philnik wrote:
> var-const wrote:
> > philnik wrote:
> > > var-const wrote:
> > > > Why is `std::identity` passed explicitly here, instead of relying on the default argument?
> > > There is no default argument. This is the predicate.
> > Ah, right -- seeing `std::identity`, I mistook it for the projection. Perhaps change it to something else that looks more like a predicate (you could create a simple global functor like `AlwaysTrue` or similar and reuse it across the tests if you'd like)?
> I'd much rather just use a simple lambda. I can add a TODO so we change it once AppleClang supports them in this context if you want.
FWIW, I still feel that using `std::identity` as a predicate is unnecessarily confusing, but this is non-blocking.

  rG LLVM Github Monorepo



More information about the libcxx-commits mailing list