Discussion: Rvalue refs and a Move construtor for D
Suleyman
sahmi.soulaimane at gmail.com
Mon Sep 9 01:25:18 UTC 2019
On Monday, 9 September 2019 at 01:09:52 UTC, Manu wrote:
> [...]
> For instance, perfect forwarding can't deal with scope. We have
> talked
> about `auto ref` being able to address the perfect forwarding
> issue
> with `@rvalue ref`, but `scope` and `return` has never had any
> kind of
> solution.
Why should there be a solution? Lvaluness is overloadable in D,
and with rvalue ref rvaluness also becomes overloadable. scope is
not overloadable. Ex:
```
void foo(return scope ref int i) {}
void foo(ref int i) {}
void main()
{
int i;
foo(&i); // error: ambiguous call
}
```
More information about the Digitalmars-d
mailing list