Discussion: Rvalue refs and a Move construtor for D

Suleyman sahmi.soulaimane at gmail.com
Thu Sep 5 19:10:27 UTC 2019


On Thursday, 5 September 2019 at 08:29:23 UTC, RazvanN wrote:
> Why not define the move constructor like this:
>
> this(S rhs) {}
>
> I know it takes by value, but up until now it has been referred 
> to as rvalue constructor. Behind the scenes the compiler will 
> treat it as a move constructor and therefore will take the 
> first parameter by ref. Now we have a clear distinction between 
> copy constructor and move constructor. It should probably be in 
> a different overload set than the other constructors.

You and kinke are orbiting around the same idea. Which is 
essentially making value parameters implicitly rvalue ref. You 
need to elaborate more on that. How it should behave, and how it 
would affect existing code.



More information about the Digitalmars-d mailing list