Initializing "two-dimensional" compile-time enum

Uranuz neuranuz at gmail.com
Sun Nov 24 04:01:49 PST 2013


Greetings! I have a problem in my code and I need an advice. I 
need possibility of creating "two-dimensional" AA in module scope 
that I can access at compile-time. I considered that it should be 
marked as enum to do this but I get strange error. There is a 
piece of code to test.

//---------------
import std.stdio;


enum string[int][string] pohodEnumValues = [
	"vid": [ 3: "skiing", 5: "rafting", 7: "jumping" ],
	"ks": [ 1: "first", 2: "second", 3: "third" ],
	"prepare": [ 1:"planning", 3:"preparing", 5:"complete" ]
];


void main()
{
	writeln(pohodEnumValues);
	
}
//--------END OF CODE -----

In dmd 2.064.2 I get following output:

Compilation output:
/d521/f517.d(4): Error: not an associative array initializer

Elements of AA are used as template arguments so I need them at 
compile-time. I need help, please))


More information about the Digitalmars-d mailing list