[#bsl-vector-027-swap]
= xref:bsl.adoc[bsl]::xref:bsl/vector-027.adoc[vector&lt;MetricSampleGroup&gt;]::swap
:relfileprefix: ../../
:mrdocs:

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;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
swap(xref:bsl/vector-00d.adoc[vector&lt;MetricSampleGroup&gt;]& other) noexcept(&sol;&ast; see-below &ast;&sol;);
----

== Exception specification

This function is potentially-throwing unless `AllocatorTraits&colon;&colon;propagate&lowbar;on&lowbar;container&lowbar;swap&colon;&colon;value &verbar;&verbar; AllocatorTraits&colon;&colon;is&lowbar;always&lowbar;equal&colon;&colon;value`.


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