Discussion: Rvalue refs and a Move construtor for D
Mike Franklin
slavo5150 at yahoo.com
Thu Aug 29 00:11:43 UTC 2019
On Wednesday, 28 August 2019 at 23:32:01 UTC, Suleyman wrote:
> The move constructor and the move assignment operator can be
> made in D with or without rvalue refs. Here a short comparison
> of both scenarios.
>
> ## With rvalue ref
>
> Example:
> ```
> struct S
> {
> this(@rvalue ref S) { /* move constructor */ }
> auto opAssign(@rvalue ref S) { /* move op assign */ }
> }
> ```
>
> * Pros:
> - seems natural: doesn't smell like compiler magic (but it
> still is compiler magic, at least until D adopts implicit
> constructors)
There are some of us that would really like implicit constructors
(done right; not like C++) for other use cases. How would
implicit constructors help this situation, and should it be
included as part of this proposal?
Mike
More information about the Digitalmars-d
mailing list