Move Constructors - Converting Lvalues to Rvalues

Timon Gehr timon.gehr at gmx.ch
Tue Oct 1 20:15:51 UTC 2024


On 10/1/24 19:37, Walter Bright wrote:
> On 10/1/2024 12:27 AM, Dukc wrote:
>> Why special syntax? `move` is a DRuntime function so it's expected 
>> that it can have special semantics, even without special syntax.
> 
> Converting to an rvalue is an enabler of other functions, too, not just 
> move. __rvalue is a building block, not a complete function.

`move` currently accepts an lvalue and moves it into the return value, 
leaving `.init` in the argument.

I guess the new implementation you have in mind is something like the 
following?

```d
auto move(T)(ref T arg)=>__rvalue(arg);
```


More information about the Digitalmars-d mailing list