== Quote from Max Samukha ([email protected])'s article
> Not that I fiercely disagree but ideally I'd want it to be obliterated
> to an invalid but easily recognizable state. It might help to discover
> dangling pointer errors early. Otherwise, leaving a destroyed object in
> a perfectly valid state may make debugging more fun than it needs to be.
You could use:
class A
{
int guard = 0xdeadbeef;
this () { guard = 0; }
invariant () { assert (guard == 0); }
}
Really annoying, though, and it makes more sense to set the guard in the
destructor. (A compiler option to do something like this automatically
would be nice.)