C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::ranges::equal(v, {1,2,3,4,5})

From: Zhihao Yuan <zy_at_[hidden]>
Date: Wed, 25 Jan 2023 21:29:12 +0000
On Wednesday, January 25th, 2023 at 5:15 AM, Paolo Di Giglio via Std-Proposals <std-proposals_at_[hidden]> wrote:


>

> If you don't want to abuse std::initializer_list to create literal-like
> lists of values, I wonder if using an array reference would do the
> trick:
>

> template<ranges::input_range R1, class V2, std::size_t N,
> class Pred = ranges::equal_to,
> class Proj1 = std::identity, class Proj2 = std::identity>
> requires std::indirectly_comparable<ranges::iterator_t<R1>, const V2*,
> Pred, Proj1, Proj2>
> constexpr bool equal( R1&& r1, V2 const (&r2)[N], Pred pred = {},
> Proj1 proj1 = {}, Proj2 proj2 = {});
>

> [...]
>

> What are your thoughts on this?


Looks good to me!

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________

Received on 2023-01-25 21:29:30