Discussion: Rvalue refs and a Move construtor for D

Suleyman sahmi.soulaimane at gmail.com
Sat Sep 7 21:09:45 UTC 2019


On Saturday, 7 September 2019 at 12:04:49 UTC, kinke wrote:
> ```
> void foo()(auto ref S s)
>   if (__traits(isRvalueRef, s));
> ```

This is a really just an awkward way of doing `void foo(@rvalue 
ref S s)`.

> I'd prefer the latter value-view, as that's compatible with 
> current semantics.

At this point you have essentially admitted rvalue ref in the 
language but you're fighting to keep it hidden from the user as 
much as possible. I personally don't thing rvalue ref is that 
much dangerous to be kept away from the programmers hand. Hiding 
rvalue ref under auto ref is simply discouraging people from 
using it.



More information about the Digitalmars-d mailing list