How can I rewrite foo() function as a free-function that won't cause struct copying? My simplified code is:
========
struct S
{
    ref S foo() return
    {
        return this;
    }
}

void main()
{
    S().foo().foo().foo();
}
========
If I write it like "auto foo(S s) { return s; }" then statement in main() will copy value of S three times and I want to avoid this.

Reply via email to