[#BloombergLP-bslstp-Util-swapContainers] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstp.adoc[bslstp]::xref:BloombergLP/bslstp/Util.adoc[Util]::swapContainers :relfileprefix: ../../../ :mrdocs: Exchange the contents of the specified containers. == Synopsis Declared in `<bslstp_util.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class CONTAINER, class QUICKSWAP_FUNC> static void swapContainers( CONTAINER& c1, CONTAINER& c2, QUICKSWAP_FUNC const& quickswap); ---- == Description Correctly handle the case where the two containers have different allocator values. The `quickswap` argument is a binary function object that is called to quickly swap two `CONTAINER` objects with matching allocators. (The `quickswap` object does not need to check that the allocator matched ‐‐ it is guaranteed by the caller.) Strong exception guarantee: if the allocator or copy constructor of either container throws an exception, then the values of `c1` and `c2` are left unchanged. The `quickswap` function must not throw an exception. [.small]#Created with https://www.mrdocs.com[MrDocs]#