C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Attribute [[discard]] and attributes on expressions

From: Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
Date: Thu, 12 Oct 2023 11:43:53 +0200
Hi,

On 11/10/2023 20:41, Bjorn Reese via Std-Proposals wrote:
> It is useful for ignoring a parameter pack:
>
> template <typename... Args>
> void foo(Args... args)
> {
> discard(args...);
> }

I'd wager you can fold over a comma for the same purpose.

   [[discard]] (args, ...);


But are we in [[discard]] territory, or in [[maybe_unused]] territory?
The purpose of [[discard]] is really for expressions, I don't see much
value at discarding a pack as-is?

Thank you,
-- 
Giuseppe D'Angelo

Received on 2023-10-12 09:43:58