Really in need of help with std.container.array.d

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Oct 19 13:39:17 PDT 2014


On Sunday, 19 October 2014 at 20:10:33 UTC, Nordlöw wrote:
> Used your ideas here
>
> https://github.com/nordlow/phobos/commit/be6b5f8c4d428a9708a52757a3f31aab6878d379
>
> but unittests now fails as
>
> array.d(234,13): Error: mutable method 
> std.container.array.Array!int.Array.opAssign is not callable 
> using a const object

You didn't make the change we just discussed.

Change line 234 from `_outer = data;` to `_outer_ = data;`.

You also need to guard much more with `static if (isMutable!A)`:
* everything that returns (non-const) T,
* everything that returns Range!A,
* everything that mutates elements (e.g. opSliceAssign).

And you can't do `return typeof(this)(...);` when the return type
is `Range!(const(A))`, because `typeof(this)` can be
`const(Range!A)` which is not the same. Spell the type out or use
`typeof(result)`.


More information about the Digitalmars-d-learn mailing list