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