associative arrays:

Jarrett Billingsley jarrett.billingsley at gmail.com
Wed Oct 1 12:27:14 PDT 2008


On Wed, Oct 1, 2008 at 8:18 PM, 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"]);
>     }
>
> 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?
>

Might be helpful to know what version of the compiler you're using.
This code works for me in 1.034.



More information about the Digitalmars-d mailing list