Function RcPtr.lock
Creates a new non weak RcPtr that shares ownership of the managed object (must be RcPtr).
If there is no managed object, i.e. this is empty or this is expired, then the returned RcPtr is empty.
Method exists only if RcPtr is isWeak
Examples
{
RcPtr!long x = RcPtr!long .make(123);
auto w = x .weak; //weak ptr
RcPtr!long y = w .lock;
assert(x == y);
assert(x .useCount == 2);
assert(y .get == 123);
}
{
RcPtr!long x = RcPtr!long .make(123);
auto w = x .weak; //weak ptr
assert(w .expired == false);
x = RcPtr!long .make(321);
assert(w .expired == true);
RcPtr!long y = w .lock;
assert(y == null);
}