unique_ptr::reset

Releases the currently owned resource and accepts ownership of the provided new resource. Calls the deleter function to act on the previously stored address, and stores the provided address, replacing the old resource. The use of reset does nothing if the new address is the same as the currently stored address.

void reset(pointer _Ptr = pointer());
void reset(nullptr_t _Ptr);

Parameters

Parameter

Description

_Ptr

A pointer to the resource to accept.

Remarks

If _Ptr == stored_ptr the member function does nothing. Otherwise, if _Ptr != 0 it calls get_deleter()(stored_ptr) and stores _Ptr in stored_ptr.

Requirements

Header: <memory>

Namespace: std

See Also

Reference

unique_ptr Class

<memory>

Other Resources

unique_ptr Members

<memory> Members