I'm trying to understand the exception safety of the template <class U> void shared_ptr::reset (U* p);
function. In the documentation I found this:
Additionally, a call to this function has the same side effects as if shared_ptr's destructor was called before its value changed (including the deletion of the managed object if this shared_ptr was unique).
So, we can assume that destructor doesn't throw. But what if the operator new
throws? What state of the shared_ptr
will we have then? Does it remain unchanged?