IntrusivePtr.expired

Equivalent to useCount() == 0 (must be IntrusivePtr.WeakType).

Method exists only if IntrusivePtr is isWeak

struct IntrusivePtr
@property scope const nothrow @safe @nogc
bool
expired
(
this This
)
()

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);
}

Meta