##### 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 ); |  | (since C++11)

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=91840"
Category:

- unconditionally noexcept

Hidden categories:

- Pages with unreviewed unconditional noexcept template
- Pages with unreviewed noexcept template