On Wednesday, 7 November 2012 at 02:06:09 UTC, Rob T wrote:
What about the case where we want to pass a source argument either by reference or as a copy depending on the l/r value situation?

eg
void f( ref a );
void f( a );

--rt

I don't get what you mean - that's why the 2 overloads are for (you forgot the const/in keyword - beware! :))

void f( in ref T a );
void f( in T a );

rvalue binds to the latter overload (argument not copied, but moved directly).
lvalue binds to the first overload (reference).
Works with v2.060.

Reply via email to