std::iter_swap

From Cppreference

Jump to: navigation, search
Defined in header <algorithm>

template< class ForwardIterator1, class ForwardIterator2 >
void iter_swap( ForwardIterator1 a, ForwardIterator2 b );

Swaps the values of the elements the given iterators are pointing to.

Contents

Parameters

a, b - iterators to the elements to swap

Return value

(none)

Complexity

constant

Equivalent function

template<class ForwardIterator1, class ForwardIterator2>
void iter_swap(ForwardIterator1 a, ForwardIterator2 b)
{
   std::swap(*a, *b);
}

Example

See also

swap
swaps the values of two objects
(function template)
swap_ranges
swaps two ranges of elements
(function template)
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
In other languages