Namespaces
Variants
Views
Actions

std::swap(std::pair)

From cppreference.com
< cpp‎ | utility‎ | pair
Defined in header <utility>
template< class T1, class T2 >
void swap( pair<T1,T2>& lhs, pair<T1,T2>& rhs ) noexcept(/* see below */);
(since C++11)

Swaps the contents of lhs and rhs. Equivalent to lhs.swap(rhs).

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)

Contents

[edit] Parameters

lhs, rhs - pairs whose contents to swap

[edit] Return value

(none)

[edit] Exceptions

noexcept specification:  
noexcept(noexcept(lhs.swap(rhs)))

[edit] See also

swaps the values of two objects
(function template) [edit]