Introduction Smart pointers are mainly used to automate the management of resources. There are std::unqiue_ptr, std::shared_ptr and std::weak_ptr according to their usage. unique_ptr unique_ptr is mainly used to implement exclusive management of a resource object whose life cycle will end at the end of the unique_ptr declaration cycle or when it is pointed to another resource. A resource managed by unique_ptr can be transferred to another unqiue_ptr via std::move. The following are some simple examples.