table of contents
        
      
      
    | std::swap(std::pair)(3) | C++ Standard Libary | std::swap(std::pair)(3) | 
NAME¶
std::swap(std::pair) - std::swap(std::pair)
Synopsis¶
 Defined in header <utility>
  
   template< class T1, class T2 > (since C++11)
  
   void swap( std::pair<T1,T2>& x, std::pair<T1,T2>& y )
    (until C++20)
  
   noexcept(/* see below */);
  
   template< class T1, class T2 >
  
   constexpr void swap( std::pair<T1,T2>& x,
    std::pair<T1,T2>& y (since C++20)
  
   )
  
   (1)
  
   noexcept(/* see below */);
  
   template< class T1, class T2 >
  
   constexpr void swap( const std::pair<T1,T2>& x, const (2)
    (since C++23)
  
   std::pair<T1,T2>& y )
  
   noexcept(/* see below */);
  
   Swaps the contents of x and y. Equivalent to x.swap(y).
  
   1) This overload participates in overload resolution only if
  
   std::is_swappable_v<first_type> &&
    std::is_swappable_v<second_type> is
  
   true. (since C++17)
  
   2) This overload participates in overload resolution only if
  
   std::is_swappable_v<const first_type> &&
    std::is_swappable_v<const
  
   second_type> is true.
Parameters¶
x, y - pairs whose contents to swap
Return value¶
(none)
Exceptions¶
 noexcept specification:
  
   noexcept(noexcept(x.swap(y)))
See also¶
 swap swaps the values of two objects
  
   (function template)
  
   std::swap(std::tuple) specializes the std::swap algorithm
  
   (C++11) (function template)
| 2022.07.31 | http://cppreference.com |