SysTutorials

Linux Manual Pages › Section 3

stdswapstdforward_list(3)

std::swap(std::forward_list) - std::swap(std::forward_list)

Synopsis

template <class T, class Alloc>
(since C++ 11)
    void swap(forward_list<T, Alloc> &lhs, (until C++ 17)
                                               forward_list<T, Alloc> &rhs);
template <class T, class Alloc>
void swap(forward_list<T, Alloc> &lhs, (since C++ 17)
                                           forward_list<T, Alloc> &rhs) noexcept(/* see below */);

Specializes the std::swap algorithm for std::forward_list. Swaps the contents of lhs and rhs. Calls lhs.swap(rhs).

Parameters

lhs, rhs - containers whose contents to swap

Return value

(none)

Complexity

Constant.

Exceptions

noexcept specification: (since C++17) noexcept(noexcept(lhs.swap(rhs)))

See also

     swaps the contents swap (public member function)