How to turn this C++ into D?

thedeemon via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 6 03:20:52 PST 2014


On Wednesday, 5 November 2014 at 17:45:00 UTC, luminousone wrote:
> abstract class foo {
>     static DList!foo foo_list;
>     ~this(){ foo_list.remove(this); }

One note: when your program exits the runtime does a final GC 
cycle and collects those things calling destructors/finalizers, 
however the static data can easily be already 
collected/destructed at this moment, so attempting to access it 
from object's finalizer will crash. One should not ever access 
any reference types and data outside the object itself from a 
destructor/finalizer.


More information about the Digitalmars-d-learn mailing list