std::swap(std::pair) (3) - Linux Manuals

std::swap(std::pair): std::swap(std::pair)

NAME

std::swap(std::pair) - std::swap(std::pair)

Synopsis


Defined in header <utility>
template< class T1, class T2 > (since C++11)
void swap( pair<T1,T2>& x, pair<T1,T2>& y ) noexcept(/* see below */); (until C++20)
template< class T1, class T2 > (since C++20)
constexpr void swap( pair<T1,T2>& x, pair<T1,T2>& y ) noexcept(/* see below */);


Swaps the contents of x and y. Equivalent to x.swap(y).


This function does not participate in overload resolution unless std::is_swappable_v<first_type> && std::is_swappable_v<second_type> is true. (since C++17)

Parameters


x, y - pairs whose contents to swap

Return value


(none)

Exceptions


noexcept specification:
noexcept(noexcept(x.swap(y)))

See also


     swaps the values of two objects
swap (function template)