According to reference, the member function evaluates the expression delete myptr, but only if the stored pointer value myptr changes as a result of function call. It then replaces the stored pointer with ptr.
But I still don't get it. Does it mean this member function deletes current myptr and points to another memory space?
Will the memory of new int(100) be freed after that?Code:std::auto_ptr<int> p (new int(100)); p.reset(new int(200));