std says:
shared_ptr<T> lock() const noexcept;
Returns:
expired() ? shared_ptr<T>() : shared_ptr<T>(*this).
but in between expired returning false (the object still exists) and the construction of the shared_ptr another thread could remove the last strong reference, thus throwing an unexpected exception? how to prevent this?
or do i miss something?