The liabilities of binding rvalues to ref
Peter Alexander
peter.alexander.au at gmail.com
Thu May 9 10:45:16 PDT 2013
On Thursday, 9 May 2013 at 17:27:41 UTC, Steven Schveighoffer
wrote:
> Short answer: no matter what, we have to find a way to be able
> to write one function that takes by ref, and accepts both
> rvalues and lvalues. If ref const is that way, so be it. If
> auto ref is that way, so be it. If it's plain-old ref, I'm
> fine with that too.
Allowing plain-old ref to bind to rvalues would be a massive
mistake in my opinion. See case (2) in the original post.
It seems that 'auto ref' would be suitable, provided we can find
a way for it to work with normal functions (in a sensible way,
not like templates).
More information about the Digitalmars-d
mailing list