std::swap(std::vector) - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::swap(std::vector)

From cppreference.com
< cpp‎ | container‎ | vector

[edit template]

template< class T, class Alloc > void swap( vector<T,Alloc>& lhs, vector<T,Alloc>& rhs ); |  |

Specializes the std::swap algorithm for std::vector. Swaps the contents of `lhs` and `rhs`. Calls lhs.swap(rhs).

### [edit] Parameters

lhs, rhs | - | containers whose contents to swap

### [edit] Return value

(none)

### [edit] Complexity

Constant.

### [edit] See also

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

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/container/vector/swap2&oldid=50826"