unique_ptr::swap

Exchanges pointers between two unique_ptr objects.

void swap(unique_ptr& _Right);

Parameters

  • _Right
    A unique_ptr used to swap pointers.

Remarks

The member function swaps stored_ptr with right.stored_ptr and stored_deleter with right.stored_deleter.

Requirements

Header: <memory>

Namespace: std

See Also

Reference

unique_ptr Class

<memory>

Thread Safety in the C++ Standard Library