SysTutorials

Linux Manual Pages › Section 3

stdswapstdtuple(3)

std::swap(std::tuple) - std::swap(std::tuple)

Synopsis

template <class... Types>
(since C++ 11)
    void swap(tuple<Types...> &lhs, tuple<Types...> &rhs) noexcept(/* see below */);
(until C++ 20)
    template <class... Types>
    constexpr void(since C++ 20)
        swap(tuple<Types...> &lhs, tuple<Types...> &rhs) noexcept(/* see below */);

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