RcPtr.opAssign

Releases the ownership of the managed object, if any.

After the call, this manages no object.

  1. void opAssign(typeof(null) nil)
    struct RcPtr
    scope
    void
    opAssign
    (
    MemoryOrder order = MemoryOrder.seq
    this This
    )
    (
    typeof(null) nil
    )
    if (
    isMutable!This
    )
  2. void opAssign(Rhs desired)

Examples

{
    RcPtr!long x = RcPtr!long.make(1);

    assert(x.useCount == 1);
    x = null;
    assert(x.useCount == 0);
    assert(x == null);
}

{
    RcPtr!(shared long) x = RcPtr!(shared long).make(1);

    assert(x.useCount == 1);
    x = null;
    assert(x.useCount == 0);
    assert(x == null);
}

{
    shared RcPtr!(long) x = RcPtr!(shared long).make(1);

    assert(x.useCount == 1);
    x = null;
    assert(x.useCount == 0);
    assert(x == null);
}

Meta