[dmd-beta] D 2.059 beta 4
Andrei Alexandrescu
andrei at erdani.com
Tue Apr 10 00:11:23 PDT 2012
On 4/10/12 1:41 AM, Nick Sabalausky wrote:
> No, not when it sees:
>
> void foo(ref T t) { ... }
>
> It's when it sees:
>
> void foo(auto ref T t) { ... }
Yah, I think this could work, but I'm not 100% sure.
So auto ref in a template function means "generate code appropriately
with or without ref".
Now, if a function is NOT a template, we could have a completely
different approach to the same issue. In that context, "auto ref" might
mean "I don't care, just accept references to rvalues too!"
That would take care of the matter. It's different from the C++ rule
because the user can still overload on ref and rvalue if they need the
distinction, and "auto ref" offers an explicit (not implicit) route to
achieving "I don't care".
Andrei
More information about the dmd-beta
mailing list