On Monday, 29 May 2017 at 07:46:07 UTC, Stanislav Blinov wrote:
On Monday, 29 May 2017 at 07:39:40 UTC, Dukc wrote:
[snip]
Explicitly? It is:
import std.stdio;
struct S
{
int v;
}
void foo(ref S s)
{
writeln("took S by ref: ", s.v);
}
void foo(S s)
{
writeln("took rvalue S...");
foo(s); // calls ref overload
}
void main()
{
S s;
foo(s); // calls ref overload
foo(S.init); // calls rvalue overload
}
And for templates we have auto ref.
Of course, I should have noticed one can already do it that way.
No need for change, then (imo).