DIP74: Reference Counted Class Objects
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Fri Feb 27 08:02:21 PST 2015
On 2/27/15 7:52 AM, Manu via Digitalmars-d wrote:
> Can I call opAddRef/opRelease from within the postblit/destructor
> manually and expect the compiler to elide calls correctly?
> That doesn't seem foolproof though, and you also said manual calls are
> not @safe. Why not specify a call sequence?
Ah, I think you mean structs that have a class member? The compiler will
insert opAddRef and opRelease appropriately:
=========
* struct, class, and closure types that have RCO members accommodate
calls to opRelease during their destruction.
=========
Andrei
More information about the Digitalmars-d
mailing list