Namespaces
Variants
Views
Actions

std::vector::swap

From cppreference.com
< cpp | container | vector
Revision as of 14:10, 4 May 2012 by P12bot (Talk | contribs)
void swap( vector& other );

Exchanges the contents of the container with those of other.

All iterators and references remain valid. The past-the-end iterator is invalidated.

The behavior is undefined if get_allocator() != other.get_allocator() and std::allocator_traits<allocator_type>::propagate_on_container_swap::value != true.

Contents

Parameters

other - container to exchange the contents with

Return value

(none)

Exceptions

noexcept specification:  
noexcept
  (since C++11)

Complexity

Constant

See also

specializes the std::swap algorithm
(function template) [edit]