class destruction

Q via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 9 08:24:55 PDT 2015


On Wednesday, 9 September 2015 at 15:19:04 UTC, Adam D. Ruppe 
wrote:
> On Wednesday, 9 September 2015 at 15:10:33 UTC, Q wrote:
>> But since D has a GC and (per default) force to heap allocate 
>> a class. So IMO the GC should also destroy it, everything else 
>> is just awkward.
>
> Well, it *does* by default. If that's what you want, just do it 
> the plain way with simple `new`. It will be destroyed (and any 
> structs inside also destroyed) when the GC gets it.

I thought that is not guaranteed, according to the docs?


More information about the Digitalmars-d-learn mailing list