[#bsl-swap-06f]
= xref:bsl.adoc[bsl]::swap
:relfileprefix: ../
:mrdocs:

Efficiently exchange the values of the specified `a` and `b` objects&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class CHAR&lowbar;TYPE,
    class CHAR&lowbar;TRAITS,
    class ALLOCATOR&gt;
void
swap(
    xref:bsl/basic_stringbuf.adoc[basic&lowbar;stringbuf&lt;CHAR&lowbar;TYPE, CHAR&lowbar;TRAITS, ALLOCATOR&gt;]& a,
    xref:bsl/basic_stringbuf.adoc[basic&lowbar;stringbuf&lt;CHAR&lowbar;TYPE, CHAR&lowbar;TRAITS, ALLOCATOR&gt;]& b);
----

== Description

This method provides the no&hyphen;throw exception&hyphen;safety guarantee if `a` and `b` allocators compare equal&period; Note that this function is only available for C&plus;&plus;11 (and later) language standards&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *a*
| first buffer to exchange
| *b*
| second buffer to exchange
|===


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