Copy a struct and its context

Rene Zwanenburg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Sep 11 02:34:03 PDT 2016


On Sunday, 11 September 2016 at 05:44:13 UTC, Yuxuan Shui wrote:
> I recently noticed nested struct capture its context by 
> reference (which, BTW, is not mentioned at all here: 
> https://dlang.org/spec/struct.html#nested). And bliting a 
> struct obviously doesn't do a deep copy of its context.
>
> So my question is, is there a way to deep copy the context of a 
> struct?

I've tried a few things, but I don't think you can. The root 
issue is that the context pointer is void*, so you can't do 
meaningful reflection on it.


More information about the Digitalmars-d-learn mailing list