Non-const std.container.Array.opIndex and alikes blocks serialization

"Nordlöw" via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Sep 28 02:04:41 PDT 2014


On Sunday, 28 September 2014 at 08:58:27 UTC, Nordlöw wrote:
> In my strive to add msgpacking support for std.container.Array 
> I've been blocked by the fact that std.container.Array.opIndex 
> only has one overload which is non-const probably because it 
> returns a ref T. This doesn't place nicely with serialization.
>
> Shouldn't inout be used here?

Further I've tried tagging all opIndex in array.d with inout as

     inout ref T opIndex(size_t i) inout

but then I get another error

array.d(479,30): Error: 
cast(string)this._data.refCountedPayload()._payload[i] is not an 
lvalue


More information about the Digitalmars-d-learn mailing list