C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Member apply

From: Barry Revzin <barry.revzin_at_[hidden]>
Date: Mon, 3 Jul 2023 14:14:57 -0500
On Mon, Jul 3, 2023, 10:15 AM Kang Hewill via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> Dear experts,
>
> With the introduction of deducing this in C++23, variants in C++26 will
> have a member visit P2637R3 <https://wg21.link/P2637R3>, which is a great
> feature.
> I wonder, is it good to also add member apply to tuple-like objects? For
> example:
>
> auto sum = std::tuple{0, 'a'}.apply(std::plus{});
> auto dist = ranges::subrange{...}.apply([](auto i, auto s) { return s
> - i; });
>
> Is this consistency superfluous, or does it have some value? One benefit
> I can think of is that this enables us to write the form of
>
> tuple.apply(...).apply(...).apply(...).apply(...)
>
> which may be an enhancement. What do you think?
>
> Hewill
>

R0 of this paper already proposed it, and LEWG didn't like it. First
telecon it was discussed at (
https://github.com/cplusplus/papers/issues/1303#issuecomment-1301074000)
there was a poll to remove the apply part, 2-6-6-1-0.

Barry

>

Received on 2023-07-03 19:15:11