C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Another reason why we should have simple operator for forward (and move)

From: Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
Date: Sun, 8 Oct 2023 17:29:17 +0200
On 08/10/2023 17:25, Frederick Virchanza Gotham via Std-Proposals wrote:
> auto forwardingLambda = [](auto&& param) { f(std::forward<T>(param)); };
> It doesn't compile because we don't have 'T'. In order to keep the
> 'auto' in there, we would need to write:

But why do you *need* to keep the `auto` in there?

> []<class T>(T&& param) { f(std::forward<T>(param)); }


My 2 c,
-- 
Giuseppe D'Angelo

Received on 2023-10-08 15:29:21