rvalues -> ref (yup... again!)
Kagamin
spam at here.lot
Wed Mar 28 09:06:23 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);
>
> That's just hideous and in-defensible.
>
> A better story would be:
>
> func(f(x), f(y), f(z));
> =>
> func(x.f, y.f, z.f);
Another workaround:
auto r(T)(T a)
{
struct R { T val; }
return R(a);
}
void f(in ref int p);
int main()
{
f(1.r.val);
return 0;
}
More information about the Digitalmars-d
mailing list