Originally Posted by
CornedBee
Actually, copying a weak_ptr modifes the weak ptr count, so it's far from free.
So, why use a shared resource without sharing ownership? Because there are circumstances where you don't want this shared resource to stay alive. Caching comes to mind. Suppose you have a number of components that all use a big shared resource. The usage pattern is such that there's a period of high use followed by a period of no use, in every component individually.
So, during a high usage period the component would acquire a shared_ptr to the resource and store it. Another component might also acquire the shared_ptr during the same time. When the component enters a period of no usage, it releases the shared_ptr, but keeps a weak_ptr. When the component needs the resource again, it first checks if the weak_ptr is still valid. If not, it has to reload the resource from disk.