Range violation with AAs
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Oct 17 11:22:53 PDT 2016
On 10/17/2016 10:43 AM, 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?
So, x is a user-defined type and the line that fails is
x["a"] ~= 42;
Unfortunately, as far as I know, that's a privilege reserved for
built-in AAs.
It still feels like x["a"] could return a proxy that could later add a
new element and then apply ~= on it. (I haven't read the rest of your
code to see whether you've already done that.)
Ali
More information about the Digitalmars-d-learn
mailing list