IntrusivePtr.get

Get reference to managed object of ElementType or value if ElementType is reference type (class or interface) or dynamic array.

  1. inout(ElementType) get [@property getter]
  2. inout(ElementType) get [@property getter]
    struct IntrusivePtr
    @property ref inout return pure nothrow @system @nogc
    static if(!isWeak)
    static if(!(is(ElementType == class)))
    static if(is(ElementType == struct))
    get
    ()

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);
assert(x.get.i == 123);
x.get.i = 321;
assert(x.get.i == 321);
const y = x;
assert(y.get.i == 321);
assert(x.get.i == 321);
static assert(is(typeof(y.get) == const Foo));

Meta