25 Algorithms library [algorithms]

25.3 Mutating sequence operations [alg.modifying.operations]

25.3.3 swap [alg.swap]

template<class ForwardIterator1, class ForwardIterator2> ForwardIterator2 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);

Effects: For each non-negative integer n < (last1 - first1) performs: swap(*(first1 + n), *(first2 + n)).

Requires: The two ranges [first1,last1) and [first2,first2 + (last1 - first1)) shall not overlap. *(first1 + n) shall be swappable with ([swappable.requirements]) *(first2 + n).

Returns: first2 + (last1 - first1).

Complexity: Exactly last1 - first1 swaps.

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

Effects: swap(*a, *b).

Requires: a and b shall be dereferenceable. *a shall be swappable with ([swappable.requirements]) *b.