Defined in header <algorithm> Defined in header <utility> (until C++11)(since C++11) template< class T >
void swap( T& a, T& b ); (1) template< class T2, size_t N >
void swap( T2 (&a)[N], T2 (&b)[N]); (2) (since C++11)
Exchanges the given values.
1) Swaps the values a and b.
2) Swaps the arrays a and b. In effect calls std::swap_ranges(a, a+N, b).
Parameters
a, b - the values to be swapped Type requirements - T must meet