Date: Mon, 3 Jul 2023 23:15:01 +0800
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
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
Received on 2023-07-03 15:15:14