SysTutorials

Linux Manual Pages › Section 3

stdswapstdset(3)

std::swap(std::set) - std::swap(std::set)

Synopsis

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

Specializes the std::swap algorithm for std::set. 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)