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

PlatisYialos leonidasklados at gmail.com
Tue Nov 6 11:23:51 PST 2012


On Tuesday, 6 November 2012 at 18:28:04 UTC, Ali Çehreli wrote:
> 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

Of course! Duh!


More information about the Digitalmars-d-learn mailing list