Conditional compilation inside an array initializer

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 18 16:38:26 PST 2016


On Tuesday, 19 January 2016 at 00:33:21 UTC, Johan Engelen wrote:
> Is it possible to do conditional compilation inside an array 
> initializer?

No, but you might break it up:

enum inttable_1 = [1,4];
version(smth)
     enum inttable_middle = [5,6];
else
     enum inttable_middle = [];
enum inttable_2 = [8, 1345];

int[] inttable = inttable_1 ~ inttable_middle ~ inttable_2;


More information about the Digitalmars-d-learn mailing list