Structs on the heap and destructors.
Adam D. Ruppe via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Feb 18 07:36:21 PST 2015
On Wednesday, 18 February 2015 at 15:22:47 UTC, John Colvin wrote:
> doOtherStuff must be called before doStuff.
That'll never happen; B is still valid until after A is
destroyed, if they weren't on the heap you'd see doStuff goes
first too.
You should probably make a method to clean B up yourself, I
wouldn't even use the destructor, just a regular like "dispose"
method that you can guard with a flag. I think that's the best
way to do it.
More information about the Digitalmars-d-learn
mailing list