associative arrays:

Denis Koroskin 2korden at gmail.com
Wed Oct 1 12:26:04 PDT 2008


On Wed, 01 Oct 2008 22:18:55 +0400, llee <Larry at workingwondersus.com>  
wrote:

> Is there any reason why the following fails with an ArrayBoundsError  
> error?
>
>      import std.cstream;
>
>      void main ()
>      {
>           string [string] array = ["name": "value"];
>           dout.writefln ("value: %s", array ["name"]);
>      }
>
That's one of the most frequently discussed bugs (or features?).
You can't do that (as of now).

> I've been using the following work around, But I'm not sure why the  
> above fails.
>
>      ...
>      string [string] array;
>      array ["name"] = "value";
>      ...
>
> Can anyone explain this?



More information about the Digitalmars-d mailing list