// unique_ptr.cc #include using namespace std; int main() { unique_ptr p(new int(5)); // make a smart ptr to an int holding val 5 //unique_ptr q = p; // compile error can't make copy of unique_ptr unique_ptr q = std::move(p); // Transfer ownership of p to q q.reset(); // deletes memory pointed to by q p.reset(); // does nothing, move operation invalidated p as pointer }