Global immutable AA literals

mist none at none.none
Thu Jan 24 12:00:55 PST 2013


Thank you. So simple and so illogical. Looking at your example I 
have zero understanding why AA literals just do not work at 
compile-time just out of the box.

On Thursday, 24 January 2013 at 19:30:27 UTC, Artur Skawina wrote:
> 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