Exchange the value of the specified a object with that 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. 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.
Synopsis
Declared in <bslstl_deque.h>
template<
class VALUE_TYPE,
class ALLOCATOR>
void
swap(
deque<VALUE_TYPE, ALLOCATOR>& a,
deque<VALUE_TYPE, ALLOCATOR>& b) noexcept(noexcept(a.swap(b)));
Created with MrDocs