[#bsl-swap-073] = xref:bsl.adoc[bsl]::swap :relfileprefix: ../ :mrdocs: 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. == Synopsis Declared in `<bslstl_multimap.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class KEY, class VALUE, class COMPARATOR, class ALLOCATOR> void swap( xref:bsl/multimap-0ae.adoc[multimap<KEY, VALUE, COMPARATOR, ALLOCATOR>]& a, xref:bsl/multimap-0ae.adoc[multimap<KEY, VALUE, COMPARATOR, ALLOCATOR>]& b) noexcept(false); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#