##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::shared_ptr::swap

From cppreference.com
< cpp‎ | memory‎ | shared ptr

void swap( shared_ptr& r ); |  |

Exchanges the contents of *this and `r`

### [edit] Parameters

r | - | smart pointer to exchange the contents with

### [edit] Return value

(none)

### [edit] Exceptions

`noexcept` specification:
noexcept
Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/memory/shared_ptr/swap&oldid=50180"
Category:

- unconditionally noexcept