Associative arrays give compile error

Bob Cowdery bob at bobcowdery.plus.com
Tue Oct 5 03:23:47 PDT 2010


 I can't seem to get any sense out of associative arrays. Even the
simplest definition won't compile so I must be doing something daft.

int[string] aa = ["hello":42];

Error: non-constant expression ["hello":42]

What exactly is not constant about this. The example is straight out the
book. Using D 2.0.

bob


More information about the Digitalmars-d-learn mailing list