rvalue references

Dicebot m.strashun at gmail.com
Tue Apr 23 00:45:40 PDT 2013


On Tuesday, 23 April 2013 at 07:18:41 UTC, Diggory wrote:
> I'd still like someone to explain how exactly "scope ref" would 
> differ from "ref" if DIP25/DIP35 were implemented.
>
> If the only difference is that "scope ref" can accept rvalues 
> then why would you ever use normal "ref"? There are no extra 
> restrictions needed on "scope ref" over and above normal "ref" 
> under the assumption of DIP25/DIP35.

No it is not the only difference. "scope ref" (as proposed in 
DIP35) is more restrictive in usage - can't take address of it, 
can't return it, can't implicitly cast it to normal ref. It is 
"scope" primarily and "rvalue ref solution" only secondarily.


More information about the Digitalmars-d mailing list