Struct initialization has no effect or error?

Brett Brett at gmail.com
Wed Oct 2 17:37:57 UTC 2019


struct X { int a; }

X[1] x;

x[0] = {3};

or

x[0] = {a:3};

fails;

Should the syntax not extend to the case of array assignment? 
This avoids a double copy.

X y = {3};

works fine.

So one has to do

x[0] = y;




More information about the Digitalmars-d-learn mailing list