Range violation with AAs

Basile B. via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Oct 17 12:10:54 PDT 2016


On Monday, 17 October 2016 at 17:43:19 UTC, Nordlöw wrote:
> At
>
> https://github.com/nordlow/phobos-next/blob/master/src/array_ex.d
>
> I have an array container.
>
> Everything works as expected in all unittests except for the 
> line at
>
> https://github.com/nordlow/phobos-next/blob/master/src/array_ex.d#L1649
>
> that fails as
>
>     core.exception.RangeError at array_ex.d(1649): Range violation
>
> and I have no clue why.
>
> Is this a know problem with AA's with container-like structs as 
> value types?

The same unittest with another Array (i.e not the one from 
phobos-next) gives the same error, so this confirms the other 
answer saying that's may be a builtin AA bug.

Just a question, maybe off topic, does this work:

unittest
{
     alias Key = string;
     alias A = Array!int;
     A[Key] x;
     x["a"] = [0];
}

?


More information about the Digitalmars-d-learn mailing list