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

"Nordlöw" via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Oct 19 15:19:04 PDT 2014


On Sunday, 19 October 2014 at 20:39:18 UTC, anonymous wrote:
>> 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)`.

New response at

https://github.com/nordlow/phobos/commit/ce6b9e9ae600b7c28ecddd1e3af7b1516247fb33

now errors as

array.d(927,15): Error: None of the overloads of 'opSlice' are 
callable using a const object, candidates are:
array.d(472,25):        
std.container.array.Array!int.Array.opSlice()
array.d(495,25):        
std.container.array.Array!int.Array.opSlice(ulong i, ulong j)


More information about the Digitalmars-d-learn mailing list