How do I store an immutable value into a mutable associative array?

PlatisYialos leonidasklados at gmail.com
Tue Nov 6 10:13:27 PST 2012


On Tuesday, 6 November 2012 at 17:48:55 UTC, PlatisYialos wrote:

To really give a stark example:

-------------------------------
void compiles() {
   immutable(char)[][immutable(char)[]] aMap;
   immutable(char)[] a = ['a'];
   immutable(char)[] b = ['b'];
   aMap[a] = b;
}

void doesnotcompile() {
   immutable(char)[immutable(char)] aMap;
   immutable(char) a = 'a';
   immutable(char) b = 'b';
   aMap[a] = b;
}
-------------------------------

I don't see what I'm doing wrong.  Does the compiler give special 
treatment to strings?


More information about the Digitalmars-d-learn mailing list