##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::swap(std::pair)

From cppreference.com
< cpp‎ | utility‎ | pair

Defined in header `<utility>` |  |
template< class T1, class T2 > void swap( pair<T1,T2>& lhs, pair<T1,T2>& rhs ); |  | (since C++11)

Swaps the contents of `lhs` and `rhs`. Equivalent to lhs.swap(rhs).

### [edit] Parameters

lhs, rhs | - | pairs whose contents to swap

### [edit] Return value

(none)

### [edit] Exceptions

`noexcept` specification:
noexcept(noexcept(lhs.swap(rhs)))

### [edit] See also

swap | swaps the values of two objects (function template) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/utility/pair/swap2&oldid=91775"
Category:

- conditionally noexcept

Hidden categories:

- Pages with unreviewed conditional noexcept template
- Pages with unreviewed noexcept template