Discussion: Rvalue refs and a Move construtor for D
Manu
turkeyman at gmail.com
Tue Sep 3 01:50:20 UTC 2019
On Mon., 2 Sep. 2019, 6:10 pm Suleyman via Digitalmars-d, <
digitalmars-d at puremagic.com> wrote:
> I updated the POC.
>
> You can now declare the move constructor & move opAssing like the
> following:
>
> ```
> struct S
> {
> this(ref S) @move {} // move constructor
> opAssign(ref S) @move {} // move opAssign
> }
> ```
>
> Or with rvalue ref:
>
> ```
> struct S
> {
> this(@rvalue ref S) {} // move constructor
> opAssign(@rvalue ref S) {} // move opAssign
> }
> ```
>
> All implementations use rvalue ref internally. It's just a matter
> of exposing in the language it or not.
>
Nice work!
I definitely think it needs to be on the argument and not on the method, or
it can't be used on functions that take more than one argument.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20190902/bc33e972/attachment-0001.htm>
More information about the Digitalmars-d
mailing list