How to return a const handle (view) to a mutable member of an agregate

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Mar 13 14:14:59 PDT 2016


On Sunday, 13 March 2016 at 20:10:57 UTC, Basile B. wrote:
> ref const(Array!Type) view(){}
>
> Unless the result is explicitly cast later it can't me modified.

No, it can't be modified, period. Casting away const and then 
mutating is not allowed, it has undefined behavior.


More information about the Digitalmars-d-learn mailing list