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

Ali Çehreli acehreli at yahoo.com
Tue Nov 6 10:28:03 PST 2012


On 11/06/2012 10:13 AM, PlatisYialos wrote:
 > 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;

[...]

 > Does the compiler give special treatment to strings?

No. Note that the value type is not immutable above. Individual 
characters are immutable but the whole value is not: immutable(char)[].

Ali



More information about the Digitalmars-d-learn mailing list