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

"Nordlöw" via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Oct 12 13:17:36 PDT 2014


I'm trying to figure out how to add complete support for 
constness in std.container.array.Array at

https://github.com/D-Programming-Language/phobos/commit/703305f0bfb1cc22eff3e44e351cc3db3e03f94f#commitcomment-8114056

My current solution (which currently fails) at

https://github.com/nordlow/phobos/commit/5c57cb18c2b9d340a19d19207deca5af0339cf7e#diff-0

tries to solve the problem by making wrapper struct Range a 
template that captures the constness of parenting Array. My 
current implementation of array.d at

https://github.com/nordlow/phobos/blob/inout-array-range/std/container/array.d#L221

however fails its unittests as

array.d(223,19): Error: variable 
std.container.array.Array!int.Array.Range!(inout(Array!int)).Range._outer 
only parameters or stack based variables can be inout
array.d(430,5): Error: template instance 
std.container.array.Array!int.Array.Range!(inout(Array!int)) 
error instantiating
array.d(833,5):        instantiated from here: Array!int
array.d(862,5): Error: static assert  (!true) is false

and I have no clue how to proceed with this. Please help, me and 
at least one other D developer is hindered by this.


More information about the Digitalmars-d-learn mailing list