I know that in a multi-threading environment it's not safe to check whether an object has been fully deleted by std::shared_ptr<T>::use_count() == 0, because the object's destructor may still be not completed.
But what about using std::weak_ptr::lock() instead?
if (weak_ptr.lock() == nullptr) {
// The object's destructor is guaranteed to be completed?
}