raw pointer, which the unique_ptr is said to own. A unique_ptr explicitly prevents copying of its contained pointer (as would happen with normal assignment), but the function can be used to transfer ownership of the contained pointer to another . A unique_ptr cannot be copied because its copy constructor and assignment operators are explicitly deleted. std::unique_ptr<int> p1(new int(5)); std::unique_ptr<int> p2 = p1; // Compile error. std::unique_ptr<int> p3 = std::move(p1); // Transfers ownership. p3 now owns the memory and p1 is set to nullptr. p3.reset(); // Deletes the memory. p1.reset(); // Does nothing. std::auto_ptr is deprecated under C++11 and completely removed from C++17. The copy constructor and assignment operators of do not actually copy the stored pointer. Instead, they transfer it, leaving the prior object empty. This was one way to implement strict ownership, so that only one object can own the pointer at any given time. This means that should not be used where copy semantics are needed. Since already existed with its copy semantics, it could not be upgraded to be a move-only pointer without breaking backward compatibility with existing code. shared_ptr and weak_ptr C++11 introduces and , defined in the header . C++11 also introduces ( was introduced in C++14) to safely allocate dynamic memory in the RAII paradigm. A is a container for a raw pointer. It maintains reference counting ownership of its contained pointer in cooperation with all copies of the . An object referenced by the contained raw pointer will be destroyed when and only when all copies of the have been destroyed. std::shared_ptr<int> p0(new int(5)); // Valid, allocates 1 integer and initialize it with value 5. std::shared_ptr<int[]> p1(new int[5]); // Valid, allocates 5 integers. std::shared_ptr<int[]> p2 = p1; // Both now own the memory. p1.reset(); // Memory still exists, due to p2. p2.reset(); // Frees the memory, since no one else owns the memory. A is a container for a raw pointer. It is created as a copy of a shared_ptr. The existence or destruction of copies of a shared_ptr have no effect on the shared_ptr or its other copies. After all copies of a shared_ptr have been destroyed, all weak_ptr copies become empty. std::shared_ptr<int> p1 = std::make_shared<int>(5); std::weak_ptr<int> wp1 {p1}; // p1 owns the memory. { std::shared_ptr<int> p2 = wp1.lock(); // Now p1 and p2 own the memory. // p2 is initialized from a weak pointer, so you have to check if the