std::unique_ptrptr(new MyClass); ptr.reset(new MyClass);
std::unique_ptrThis will delete the MyClass object that was being pointed to by the ptr and set the ptr to a null pointer. The std unique_ptr reset() function is part of the C++ standard library, specifically the memory header file.ptr(new MyClass); ptr.reset();