[Issue 8864] Simpler syntax for array literal of structs from one argument
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Jun 18 21:54:18 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=8864
--- Comment #2 from Kenji Hara <k.hara.pg at gmail.com> ---
Today following style initializing is properly allwed:
struct S { this(int n) {} }
S s = 1; // translated to: T t = T(1);
As a natural conclusion, following syntax should also be accepted IMO.
S[] a = [1, 2, 3];
// For each ArrayInitializer elements, implicit struct
// constructor call of type S should be considered.
Then it could be translated to:
S[] a = [S(1), S(2), S(3)];
--
More information about the Digitalmars-d-bugs
mailing list