C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Easier syntax for move-capture in lambdas

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Wed, 1 Jun 2022 09:24:32 -0400
On Wed, Jun 1, 2022 at 3:52 AM Abdullah Qasim via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> However, remember that “&&” primarily means “R-value” reference!
>
>
>
> [&&] {
>
> // this should mean “R-value” reference (sim. to const ref)
>
> }
>
>
>
> Also, you can use:
>
>
>
> using std::move;
>
>
>
> [a = move(a) , b = move(b)] {
>
>
>
> }
>
>
>
> You may also like to define a macro:
>
>
>
> #define _M(expr) ##expr = std::move(##expr)

Be aware that all identifiers starting with an underscore followed by
a capital letter are reserved for the implementation and cannot be
used by you.

Received on 2022-06-01 13:26:07