Global immutable AA literals

Artur Skawina art.08.09 at gmail.com
Thu Jan 24 11:30:16 PST 2013


On 01/24/13 19:36, mist wrote:
> You know what? Screw idiomatic. Is there _any_ way to use a compile-time associative array literal?

   template ctAA(alias aal) { enum ctAA = aal; }

   enum aa = ctAA!(["one":1, "two":2]);

   int main() {
      enum x = aa["two"];
      pragma(msg, x.stringof);
      return x;
   }

artur


More information about the Digitalmars-d mailing list