Is there a way to get this associative array initialization to work?
Jacob Carlborg
doob at me.com
Wed Jan 10 18:03:42 UTC 2018
On 2018-01-10 17:29, Steven Schveighoffer wrote:
> Right, but it doesn't work in variable declarations if that variable is
> part of an associative array.
>
> In other words:
>
> struct S
> {
> int x;
> }
>
> struct T
> {
> S s;
> }
>
> T t = {s: {x: 1}}; // nesting works here
> S[] arr = [{x: 1}, {x:2}]; // and here
> S[string] aa = ["first": {x: 1}, "second": {x: 2}]; // but not here???
Aha, I see. Didn't expect any of those to work.
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list