Is enum static?

Jonathan M Davis jmdavisProg at gmx.com
Tue Aug 20 12:38:18 PDT 2013


On Tuesday, August 20, 2013 21:33:23 John Colvin wrote:
> I presume there's a good reason why we don't have:
> enum a = [1,2,3,4];
> assert assert(is(typeof(a) == int[4]));
> 
> this works after all:
> enum int[4] a = [1,2,3,4];
> assert assert(is(typeof(a) == int[4]));

Array literals are always dynamic arrays, so [1, 2, 3, 4] is int[] by 
definition.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list