A smart pointer is a class that holds a pointer to a heap object and releases the object in its destructor. The unique pointer std::unique_ptr<T> is the sole owner of its object (unique ownership): it cannot be copied, it can be moved, which transfers the ownership and leaves the source null, and its destructor deletes the object if it holds one. std::make_unique<T>(args) allocates and constructs the object.
Computer Science · Glossaire
Qu'est-ce que « Smart pointer, unique pointer, unique ownership » ?
Aussi appelé : smart pointer · unique pointer · unique ownership