Error: non-constant expression...

bearophile bearophileHUGS at lycos.com
Fri Nov 26 14:57:37 PST 2010


Jonathan M Davis:

> At present, I don't believe that associative arrays are valid CTFE

You are wrong, the current situation with AAs is not so simple :-)


string foo(string k) {
    string[string] map = ["bar" : "spam"];
    return map[k];
}
enum string v = foo("bar");
static assert(v == "spam");
void main() {}

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list