On Friday, 25 January 2013 at 22:22:44 UTC, Szymon wrote:
So structs in D are always passed by-value? That is unfortunate...

No, that is what he speaks about:
--------
struct SomeStruct
{
        int a, b;
}

void f1(ref SomeStruct input) { }

void f2(const ref SomeStruct input) { }

void main()
{
        SomeStruct a;
        f1(a); // fine
        f2(a); // fine
        // f1(SomeStruct(0,0)); // invalid, predictable
        // f2(SomeStruct(0,0)); // invalid, surprise to C++ guys
}
--------

Reply via email to