[#BloombergLP-bslalg-RbTreeUtil-swap]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslalg.adoc[bslalg]::xref:BloombergLP/bslalg/RbTreeUtil.adoc[RbTreeUtil]::swap
:relfileprefix: ../../../
:mrdocs:

Exchange the nodes of the specified `a` and `b` trees&period;

== Synopsis

Declared in `&lt;bslalg&lowbar;rbtreeutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
void
swap(
    xref:BloombergLP/bslalg/RbTreeAnchor.adoc[RbTreeAnchor]* a,
    xref:BloombergLP/bslalg/RbTreeAnchor.adoc[RbTreeAnchor]* b);
----

== Description

Efficiently exchange the nodes in the specified `a` tree with the nodes in the specified `b` tree&period; This method provides the no&hyphen;throw exception&hyphen;safety guarantee&period; The behavior is undefined unless `a` and `b` are well&hyphen;formed (see `isWellFormed`)&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *a*
| first well&hyphen;formed tree to exchange
| *b*
| second well&hyphen;formed tree to exchange
|===


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