//copy { auto x = RcPtr!(long[]).make(10, -1); assert(x.length == 10); auto y = first(x); static assert(is(typeof(y) == RcPtr!long)); assert(*y == -1); assert(x.useCount == 2); } { auto x = RcPtr!(long[10]).make(-1); assert(x.get.length == 10); auto y = first(x); static assert(is(typeof(y) == RcPtr!long)); assert(*y == -1); assert(x.useCount == 2); } //move import core.lifetime : move; { auto x = RcPtr!(long[]).make(10, -1); assert(x.length == 10); auto y = first(x.move); static assert(is(typeof(y) == RcPtr!long)); assert(*y == -1); } { auto x = RcPtr!(long[10]).make(-1); assert(x.get.length == 10); auto y = first(x.move); static assert(is(typeof(y) == RcPtr!long)); assert(*y == -1); }
Return RcPtr pointing to first element of dynamic array managed by rc pointer ptr.