Conditional compilation inside an array initializer

Johan Engelen via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 18 16:33:21 PST 2016


Is it possible to do conditional compilation inside an array 
initializer? Something like this:
int[] inttable =
[
     1,
     4,
version(smth)  {  // <--- does not compile
     5,
     6,
}
     8,
   1345
];

(real world case: 
https://github.com/ldc-developers/ldc/blob/merge-2.069/ddmd/idgen.d#L279)

If it is not possible, what alternative solution would you use?

Thanks!


More information about the Digitalmars-d-learn mailing list