[#bsl-deque-0c-swap]
= xref:bsl.adoc[bsl]::xref:bsl/deque-0c.adoc[deque]::swap
:relfileprefix: ../../
:mrdocs:

Exchange the value of this deque with that of `other`&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;deque&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
swap(xref:bsl/deque-0c.adoc[deque&lt;VALUE&lowbar;TYPE, ALLOCATOR&gt;]& other) noexcept(AllocatorTraits&colon;&colon;is&lowbar;always&lowbar;equal&colon;&colon;value);
----

== Description

Exchange the value of this object with that of the specified `other` object&semi; also exchange the allocator of this object with that of `other` if the (template parameter) type `ALLOCATOR` has the `propagate&lowbar;on&lowbar;container&lowbar;swap` trait, and do not modify either allocator otherwise&period; This method provides the no&hyphen;throw exception&hyphen;safety guarantee&period; This operation has `O&lsqb;1&rsqb;` complexity if either this object was created with the same allocator as `other` or `ALLOCATOR` has the `propagate&lowbar;on&lowbar;container&lowbar;swap` trait&semi; otherwise, it has `O&lsqb;n &plus; m&rsqb;` complexity, where `n` and `m` are the number of elements in this object and `other`, respectively&period; Note that this method&grave;s support for swapping objects created with different allocators when `ALLOCATOR` does not have the `propagate&lowbar;on&lowbar;container&lowbar;swap` trait is a departure from the C&plus;&plus; Standard&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *other*
| deque with which to exchange value (and possibly allocator)
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
