What is the difference between an empty and a null std::shared_ptr in C++?
It’s a weird corner of shared_ptr behavior. It has a constructor that allows you to make a shared_ptr that owns something and points to something else: template< class Y > shared_ptr( const shared_ptr<Y>& r, T *ptr ); The shared_ptr constructed using this constructor shares ownership with r, but points to whatever ptr points to (i.e., … Read more