– auto_ptr deprecated mainly due to its implicit transfer of ownership causing segfault at runtime
– in general smart ptrs using a stack object to wrap a heap object or memory allocation, and override the ctors dtors and operator “=” to limit and control the behavior of the internal pointers
– when out of scope, the destructor of the stack object would be triggered, e.g. free your heap memory automatically
– shared_ptr uses operator “=” to increase “reference count” of shared ownership
– shared_ptr is thread safe(?) and overhead for reference counting
– shared_ptr is thread safe in terms of read and increment count, not safe when the actually shared_ptr is modified.
– unique_ptr uses move() to transfer ownership
– unique_ptr owns an object exclusively. Non-copyable, supports transfer-of-ownership, introduced to replace auto_ptr
– scope_ptr not copyable nor movable, and is gone when goes out of scope.
– weak_ptr is a scale down version of shared_ptr that doesn’t affect refcount, but uses the value so it should check valid before using it