23 General utilities library [utilities]
template <class T>
void swap(T& a, T& b) noexcept(see below);
Remarks: This function shall not participate in overload resolution
unless
is_move_constructible_v<T> is
true and
is_move_assignable_v<T> is
true. The expression inside noexcept is equivalent to:
is_nothrow_move_constructible_v<T> && is_nothrow_move_assignable_v<T>
Requires:
Type
T
shall be
MoveConstructible (Table
23)
and
MoveAssignable (Table
25)
. Effects:
Exchanges values stored in two locations
. template <class T, size_t N>
void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
Remarks:
This function shall not participate in overload resolution
unless
is_swappable_v<T> is
true. Effects: As if by
swap_ranges(a, a + N, b).