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

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 5 08:30:56 PDT 2022

philnik added inline comments.

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{}); };
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.

  rG LLVM Github Monorepo



More information about the libcxx-commits mailing list