Why can't a weak_ptr be constructed from a unique_ptr?
问题 If I understand correctly, a weak_ptr doesn't increment the reference count of the managed object, therefore it doesn't represent ownership. It simply lets you access an object, the lifetime of which is managed by someone else. So I don't really see why a weak_ptr can't be constructed from a unique_ptr , but only a shared_ptr . Can someone briefly explain this? 回答1: std::weak_ptr can't be used unless you convert it to std::shared_ptr by the means of lock() . if the standard allowed what you