string and char[]

Simen kjaeraas simen.kjaras at gmail.com
Fri Apr 8 03:44:42 PDT 2011


On Fri, 08 Apr 2011 12:46:08 +0200, Morlan <home at valentimex.com> wrote:

> It is OK if I write
>
>   int[char[]] asr;
>   asr["hello"] = 10;
>
> but the following does not compile:
>
>   char[] car = "hello";
>
> What is the explanation for this behaviour?

The first should not be allowed. It is a mistake to use non-immutable
keys for an associative array.

-- 
Simen


More information about the Digitalmars-d mailing list