Function IntrusivePtr.expired
Equivalent to useCount() == 0
(must be IntrusivePtr
).
bool expired(This)() const nothrow @nogc @property scope @safe;
Method exists only if IntrusivePtr
is isWeak
Examples
static struct Foo{
ControlBlock!(int, int) c;
int i;
this(int i)pure nothrow @safe @nogc{
this .i = i;
}
}
{
IntrusivePtr!Foo x = IntrusivePtr!Foo .make(123);
auto wx = x .weak; //weak pointer
assert(wx .expired == false);
x = null;
assert(wx .expired == true);
}