DIP 1016--ref T accepts r-values--Community Review Round 1

Daniel N no at public.email
Fri Jul 20 15:18:33 UTC 2018


On Friday, 20 July 2018 at 13:21:11 UTC, Jonathan M Davis wrote:
>
> auto ref was already introduced to solve this problem. The 
> problem of course is that it requires that the function be 
> templated, and while that's often desirable, it's not always a 
> viable option (e.g. it doesn't work with virtual functions). 
> So, I'm fine with adding something akin to auto ref which is 
> intended to solve the non-templated case with semantics similar 
> to those described in the DIP, but I think that it would be a 
> huge mistake to make normal ref accept rvalues.
>

I'm in favour of this DIP.

However, after this DIP... what is the point of the old "auto 
ref"? If you want to turn your function into a template it's 
trivial.

What if the current semantics of "auto ref" was redefined to what 
this DIP proposes, i.e. non-templated rvalue ref.



More information about the Digitalmars-d mailing list