##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::swap(std::function)

From cppreference.com
< cpp‎ | utility‎ | functional‎ | function

template< class R, class... Args > void swap( function<R(Args...)> &lhs, function<R(Args...)> &rhs ); |  |

Overloads the std::swap algorithm for std::function. Exchanges the state of `lhs` with that of `rhs`. Effectively calls lhs.swap(rhs).

### [edit] Parameters

lhs, rhs | - | polymorphic function wrappers whose states to swap

### [edit] Return value

(none)

### [edit] Exceptions

(none) | (until C++17)
`noexcept` specification: noexcept | (since C++17)

### [edit] Example

| This section is incomplete Reason: no example

### [edit] See also

swap | swaps the contents (public member function) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/utility/functional/function/swap2&oldid=91776"
Categories:

- unconditionally noexcept
- Todo no example

Hidden categories:

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