rvalues -> ref (yup... again!)

MattCoder nospam at mail.com
Fri Mar 23 23:35:29 UTC 2018


On Friday, 23 March 2018 at 22:01:44 UTC, Manu wrote:
> ...
> By contrast, people will NOT forgive the fact that they have to 
> change:
>
>     func(f(x), f(y), f(z));
>
> to:
>
>     T temp = f(x);
>     T temp2 = f(y);
>     T temp3 = f(z);
>     func(temp, temp2, temp3);
>...

Or you could do this:

func(tx=f(x), ty=f(y), tz=f(z));

I know it will not solve your problem, but except for the 
explicit variables, it's almost like your first example.

Well, to be honest I still can't understand why would you want to 
pass a RValue as reference.

Matt.


More information about the Digitalmars-d mailing list