Is there such thing as a weak_ptr that can't be locked (promoted to shared_ptr)? If not, why?
Maybe this question has been asked before, but I've never found a satisfactory answer. Also, for the purposes of simplicity assume I'm talking about a single-threaded application. So, what I've heard a number of times is that if you have an object that is non-owned and whose lifetime is guaranteed , you should reference it with a raw pointer. The object's owner would use a unique_ptr, and hand out raw pointers as necessary. But what if the object is non-owned , and the lifetime is not guaranteed ? Then you can use a weak_ptr, yes. But then anyone who is handed a weak_ptr could be naughty and