Bypassing the postblit?
Ritu
ritu at metaprogramming.net
Mon Dec 30 03:26:33 PST 2013
> Why would you want access to the original struct though, if you
> have a bit for bit copy? The *only* reason I could imagine, is
> to *mutate* the original struct...
Yes. That way I could make sure that the class object in the
struct gets lazily initialized to the same object in both the
source and the copied struct instance. So in the appender example
you earlier gave, both app1 and app2 can have the same internal
object.
But then the source object may not be mutable. I am not a
compiler expert, but could a special case be made in D compiler
for the cases where the source struct instance is mutable and is
made available to ease such lazy initialization?
Regards
- Ritu
More information about the Digitalmars-d
mailing list