On 3/23/12, Timon Gehr <[email protected]> wrote:
> It creates an array from key-value pairs. a[1] will be 2 and a[3] will
> be 4. Unspecified entries are default-initialized. It can be quite
> useful for building lookup tables.

Interesting. It's documented under "Static Initialization of
Statically Allocated Arrays", but I guess it works for dynamic arrays
too. I could use these for sure. :)

> Another reason why array initializers are different from array literals:
> struct S{int a,b,c;}
> S[] sarr = [{a: 1, b: 2, c: 3}, {a: 4, b: 5, c: 6}];

Yeah I knew about those, although IIRC these might be deprecated?

Reply via email to