How to make a global immutable associative array?

Dan Killebrew danielk.misc at gmail.com
Tue Mar 18 17:34:19 PDT 2014


> You just have to construct it first and then claim that it is 
> unique and so safely cast it to immutable:
>
>
> import std.exception : assumeUnique;
>
> immutable int[int] aa;
>
> static this(){
>    auto temp = [1:2, 3:4];
>    aa = assumeUnique(temp);
> }

Seems unintuitive and roundabout. Is this a bug or a feature?


More information about the Digitalmars-d mailing list