C++ Logo

std-proposals

Advanced search

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

From: Abdullah Qasim <iamminecraftredstoner_at_[hidden]>
Date: Thu, 2 Jun 2022 06:19:43 +0000
I wrote that:

You may also like to define a macro:

#define _M(expr) ##expr = std::move(##expr)

Now, if this macro gets named as _MOVE_CAPTURE (or something similar...) in <stdlib.h>, your suggestion becomes redundant.

From: Jason McKesson via Std-Proposals<mailto:std-proposals_at_[hidden]>
Sent: 01 June 2022 18:26
To: std-proposals_at_[hidden]<mailto:std-proposals_at_[hidden]>
Cc: Jason McKesson<mailto:jmckesson_at_[hidden]>
Subject: Re: [std-proposals] Easier syntax for move-capture in lambdas

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.
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2022-06-02 06:19:45