std::swap(std::tuple)

From cppreference.com
< cpp‎ | utility‎ | tuple
 
 
Utilities library
General utilities
Date and time
Function objects
Formatting library (C++20)
(C++11)
Relational operators (deprecated in C++20)
Integer comparison functions
(C++20)
Swap and type operations
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
Common vocabulary types
(C++11)
(C++17)
(C++17)
(C++17)
(C++17)

Elementary string conversions
(C++17)
(C++17)
 
std::tuple
Member functions
Non-member functions
(until C++20)(until C++20)(until C++20)(until C++20)(until C++20)(C++20)
std::swap
Deduction guides(C++17)
Helper classes
 
template< class... Types >
void swap( tuple<Types...>& lhs, tuple<Types...>& rhs ) noexcept(/* see below */);
(since C++11)
(until C++20)
template< class... Types >

constexpr void

    swap( tuple<Types...>& lhs, tuple<Types...>& rhs ) noexcept(/* see below */);
(since C++20)

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<Ti> is true for all i from 0 to sizeof...(Types).

(since C++17)

Parameters

lhs, rhs - tuples whose contents to swap

Return value

(none)

Exceptions

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

See also