Don't expect class destructors to be called at all by the GC

Mike Parker aldacron at gmail.com
Thu Dec 21 14:54:34 UTC 2017


On Thursday, 21 December 2017 at 14:26:55 UTC, Guillaume Piolat 
wrote:
> On Thursday, 21 December 2017 at 06:50:44 UTC, Mike Parker 
> wrote:
>> That's what I've taken to doing manually, by implementing a 
>> `terminate` function in my classes that I either call directly 
>> or via a ref-counted templated struct called Terminator.
>
> I feel like I'm rambling but..
> The problem with that approach is that you can't reuse Unique, 
> RefCounted, scoped!T because they rely on .destroy

I'm not proposing it as a general solution. It's easy to 
implement and it works for my use case, so it's one possible 
solution.


More information about the Digitalmars-d-learn mailing list