On Tuesday, 24 May 2016 at 15:17:37 UTC, Adam D. Ruppe wrote:
On Tuesday, 24 May 2016 at 14:29:53 UTC, John Nixon wrote:
This naively doesn’t seem right because the RHS of an
assignment should not be altered by it.
It's because the char[] being shallow copied still leads to
mutable stuff.
What I typically do here is just add a method `dup` to the
struct that deep copies. Then you do `CS cs = rhs.dup;` when
you want to construct it, like you'd do with a copy of a naked
array.
Thank you for this suggestion, perhaps a slightly neater
workaround.