cpp/memory/unique ptr

is a smart pointer that owns and manages another object through a pointer and disposes of that object when the goes out of scope.

The object is disposed of, using the associated deleter when either of the following happens:
 * the managing object is destroyed
 * the managing object is assigned another pointer via operator= or reset.

The object is disposed of, using a potentially user-supplied deleter by calling. The default deleter uses the operator, which destroys the object and deallocates the memory.

A may alternatively own no object, in which case it is called empty.

There are two versions of :
 * 1) Manages a single object (e.g. allocated with )
 * 2) Manages a dynamically-allocated array of objects (e.g. allocated with )

The class satisfies the requirements of and, but of neither  nor.