{
RcPtr!long px1 = RcPtr!long.make(1);
RcPtr!long px2 = RcPtr!long.make(2);
assert(px2.useCount == 1);
px1 = px2;
assert(*px1 == 2);
assert(px2.useCount == 2);
}
{
RcPtr!long px = RcPtr!long.make(1);
RcPtr!(const long) pcx = RcPtr!long.make(2);
assert(px.useCount == 1);
pcx = px;
assert(*pcx == 1);
assert(pcx.useCount == 2);
}
{
const RcPtr!long cpx = RcPtr!long.make(1);
RcPtr!(const long) pcx = RcPtr!long.make(2);
assert(pcx.useCount == 1);
pcx = cpx;
assert(*pcx == 1);
assert(pcx.useCount == 2);
}
{
RcPtr!(immutable long) pix = RcPtr!(immutable long).make(123);
RcPtr!(const long) pcx = RcPtr!long.make(2);
assert(pix.useCount == 1);
pcx = pix;
assert(*pcx == 123);
assert(pcx.useCount == 2);
}
Shares ownership of the object managed by rhs.
If rhs manages no object, this manages no object too. If rhs is rvalue then move-assigns a RcPtr from rhs