On Friday, 2 October 2020 at 23:28:04 UTC, claptrap wrote:
I cant see anything in the struct docs explaining why that array on the right hand side is automatically converted to a constructor call.

I'm not sure exactly where it is in the docs but that's perfectly normal.

Any declaration with initialization of a struct is turned into a construction call if it can. If not, it tries to treat it as a struct literal.

I guess this is as close as it comes:
https://dlang.org/spec/struct.html#struct-constructor

"Struct constructors are used to initialize an instance of a struct when a more complex construction is needed than is allowed by static initialization or a struct literal. "

Which sends you back up here:
https://dlang.org/spec/struct.html#static_struct_init

showing the = syntax.


opAssign is only used AFTER the struct has already been declared.

Reply via email to