Exchange the value and comparator of the specified a object with those of the specified b object; also exchange the allocator of a with that of b if the (template parameter) type ALLOCATOR has the propagate_on_container_swap trait, and do not modify either allocator otherwise. This function provides the no-throw exception-safety guarantee if and only if the (template parameter) type COMPARATOR provides a no-throw swap operation, and provides the basic exception-safety guarantee otherwise; if an exception is thrown, both objects are left in valid but unspecified states. This operation has O[1] complexity if either a was created with the same allocator as b or ALLOCATOR has the propagate_on_container_swap trait; otherwise, it has O[n + m] complexity, where n and m are the number of elements in a and b, respectively. Note that this function`s support for swapping objects created with different allocators when ALLOCATOR does not have the propagate_on_container_swap trait is a departure from the C++ Standard.
Declared in <bslstl_set.h>
template<
class KEY,
class COMPARATOR,
class ALLOCATOR>
void
swap(
set<KEY, COMPARATOR, ALLOCATOR>& a,
set<KEY, COMPARATOR, ALLOCATOR>& b) noexcept(noexcept(a.swap(b)));