20 General utilities library [utilities]

20.11 Smart pointers [smartptr]

20.11.1 Class template unique_­ptr [unique.ptr]

20.11.1.2 unique_­ptr for single objects [unique.ptr.single]

20.11.1.2.5 Modifiers [unique.ptr.single.modifiers]

pointer release() noexcept;
Postconditions: get() == nullptr.
Returns: The value get() had at the start of the call to release.
void reset(pointer p = pointer()) noexcept;
Preconditions: The expression get_­deleter()(get()) is well-formed, has well-defined behavior, and does not throw exceptions.
Effects: Assigns p to the stored pointer, and then if and only if the old value of the stored pointer, old_­p, was not equal to nullptr, calls get_­deleter()(old_­p).
[Note
:
The order of these operations is significant because the call to get_­deleter() may destroy *this.
— end note
]
Postconditions: get() == p.
[Note
:
The postcondition does not hold if the call to get_­deleter() destroys *this since this->get() is no longer a valid expression.
— end note
]
void swap(unique_ptr& u) noexcept;
Preconditions: get_­deleter() is swappable ([swappable.requirements]) and does not throw an exception under swap.
Effects: Invokes swap on the stored pointers and on the stored deleters of *this and u.