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@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?

In other words

    alias Key = string;
    alias A = Array!int;
    A[Key] x;
    x["a"] ~= 42; // triggers violation

fails.

If I initialize the value prior to append as in

    alias Key = string;
    alias A = Array!int;
    A[Key] x;
    x["a"] = A.init;
    x["a"] ~= 42; // no violation

the violation doesn't happen.

And if I replace `Array!int` with `int[]` as in

    alias Key = string;
    alias A = int[];
    A[Key] x;
    x["a"] ~= 42;

it also doesn't happen.

Reply via email to