Date: Fri, 6 Oct 2023 18:25:54 +0200
Hello,
On 06/10/2023 17:39, Bjorn Reese via Std-Proposals wrote:
> Another possibility that may be worth discussing in your paper is the
> use of a "sink" function: template <typename... T> void discard(const
> T&...) {};
Spelled like this (as in, a variadic function), I would actually find it
a bit dangerous:
(a(), b(), c()) [[discard]]
would not be equivalent to
std::discard(a(), b(), c())
due to the different sequencing.
On 06/10/2023 17:39, Bjorn Reese via Std-Proposals wrote:
> Another possibility that may be worth discussing in your paper is the
> use of a "sink" function: template <typename... T> void discard(const
> T&...) {};
Spelled like this (as in, a variadic function), I would actually find it
a bit dangerous:
(a(), b(), c()) [[discard]]
would not be equivalent to
std::discard(a(), b(), c())
due to the different sequencing.
-- But OK, comma operator is evil and everything; this leaves me with the same criticism as for `std::ignore`: * it's a library solution to a language problem * it doesn't work if the expressions yield void, which makes it unusable in generic contexts: template <typename F> void call_and_print(F &&f) { std::discard(f()); print("called f"); } void foo(); call_and_print(foo); Thank you, -- Giuseppe D'Angelo
Received on 2023-10-06 16:25:57