std::tuple<Types...>::swap (3) - Linux Manuals
std::tuple<Types...>::swap: std::tuple<Types...>::swap
NAME
std::tuple<Types...>::swap - std::tuple<Types...>::swap
Synopsis
Defined in header <tuple>
void swap( tuple& other ) noexcept(/* see below */); (since C++11)
constexpr void swap( tuple& other ) noexcept(/* see below */); (since C++20)
Calls swap (which might be std::swap, or might be found via ADL) for each element in *this and its corresponding element in other.
Parameters
other - tuple of values to swap
Return value
(none)
Exceptions
noexcept specification:
noexcept(
noexcept(swap(std::declval<T0&>>(), std::declval<T0&>())) &&
noexcept(swap(std::declval<T1&>>(), std::declval<T1&>())) && (until C++17)
noexcept(swap(std::declval<T2&>>(), std::declval<T2&>())) &&
...
)
In the expression above, the identifier swap is looked up in the same manner as the one used by the C++17 std::is_nothrow_swappable trait.
noexcept specification:
noexcept(
std::is_nothrow_swappable_v<T0> &&
std::is_nothrow_swappable_v<T1> && (since C++17)
std::is_nothrow_swappable_v<T2> &&
...
)
Example
// Run this code
Output:
Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR Applied to Behavior as published Correct behavior
LWG_2456 C++11 the noexcept specification is ill-formed made to work
See also