Assigning global and static associative arrays

ixid nuaccount at gmail.com
Fri Aug 31 07:38:13 PDT 2012


Why does this not work:

int[string] dayNumbers =
         [ "Monday"   : 0, "Tuesday" : 1, "Wednesday" : 2,
           "Thursday" : 3, "Friday"  : 4, "Saturday"  : 5,
           "Sunday"   : 6 ];

void main() {
     //Stuff
}

With the error 'non-constant expression'? This error also seems 
to prevent me making static associative arrays in functions 
elegantly.


More information about the Digitalmars-d-learn mailing list