rvalues -> ref (yup... again!)

Timon Gehr timon.gehr at gmx.ch
Wed Mar 28 12:38:22 UTC 2018


On 27.03.2018 22:25, Rubn wrote:
> 
> D already has move semantics, an easy solution to this is to just use 
> another keyword. It doesn't have to bind to const ref to get what is 
> desired:
> 
> // what was suggested in the original DIP, since scope is being used for 
> something else now
> void foo(@temp ref value)
> {
> }
> 
> Now you don't have this problem. You only get this behavior when you 
> basically say you don't care whether it is a temporary or not.
Another benefit of this solution is that the overload resolution rules 
are obvious. foo(@temp ref T value) is less specialized than both foo(T 
value) and foo(ref T value).

@Manu: Consider this.


More information about the Digitalmars-d mailing list