Are there any methods like isDestroyed or isDisposed to detect whether some object is destroyed or not?

Andrey Derzhavin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Dec 13 13:20:41 PST 2014


>
> import std.stdio;
>
> class ObjectAType {
>     bool ok;
>     this() {ok = true;}
> }
>
> void main()
> {
>     auto a = new ObjectAType;
>     assert(a.ok);
>     destroy(a);
>     assert(!a.ok);  // a has been destroyed.
> }
>

This method of detection of collected objects is what I needed.
Thanks to everybody for your advise.


More information about the Digitalmars-d-learn mailing list