20 General utilities library [utilities]

20.2 Utility components [utility]

20.2.2 swap [utility.swap]

template<class T> void swap(T& a, T& b) noexcept(see below);

Remark: The expression inside noexcept is equivalent to:

is_nothrow_move_constructible<T>::value &&

Requires: Type T shall be MoveConstructible (Table [moveconstructible]) and MoveAssignable (Table [moveassignable]).

Effects: Exchanges values stored in two locations.

template<class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(noexcept(swap(*a, *b)));

Requires: a[i] shall be swappable with ([swappable.requirements]) b[i] for all i in the range [0,N).

Effects: swap_ranges(a, a + N, b)