Discussion: Rvalue refs and a Move construtor for D

Suleyman sahmi.soulaimane at gmail.com
Sat Aug 31 20:15:22 UTC 2019


I made a POC for the implementation without rvalue ref.
Here it is: https://github.com/dlang/dmd/pull/10383.

It compiles. And works just like the rvalue ref implementation 
would.

On Thursday, 29 August 2019 at 19:04:45 UTC, Manu wrote:
> For reference, here's the C++ implementation of that entire 
> file:
>
> template <class T>
> T&& move(T& val) { return (T&&)val; }
>
> Our implementation would/should be similar.

I also added a `cast(rvalue)` which does the same as the `(T&&)` 
in C++ but returns an rvalue. And an intrinsic `__move()` and a 
`__traits(getRvalue)` which are simply syntactic flavors of 
`cast(rvalue)`.



More information about the Digitalmars-d mailing list