28 Algorithms library [algorithms]

28.6 Mutating sequence operations [alg.modifying.operations]

28.6.3 Swap [alg.swap]

template<class ForwardIterator1, class ForwardIterator2> ForwardIterator2 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2); template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2> ForwardIterator2 swap_ranges(ExecutionPolicy&& exec, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
Requires: The two ranges [first1, last1) and [first2, first2 + (last1 - first1)) shall not overlap.
*(first1 + n) shall be swappable with *(first2 + n).
Effects: For each non-negative integer n < (last1 - first1) performs: swap(*(first1 + n), ​*(first2 + n)).
Returns: first2 + (last1 - first1).
Complexity: Exactly last1 - first1 swaps.
template<class ForwardIterator1, class ForwardIterator2> void iter_swap(ForwardIterator1 a, ForwardIterator2 b);
Requires: a and b shall be dereferenceable.
*a shall be swappable with *b.
Effects: As if by swap(*a, *b).