[#BloombergLP-bslstl-swap-010]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::swap
:relfileprefix: ../../
:mrdocs:

`swap` overloads

== Synopses

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

Swap the functor wrapped by the specified `lhs` object with the functor wrapped by the specified `rhs` object&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class FUNCTOR&gt;
void
xref:BloombergLP/bslstl/swap-044.adoc[swap](
    xref:BloombergLP/bslstl/HashTable_ComparatorWrapper-0e.adoc[HashTable&lowbar;ComparatorWrapper&lt;FUNCTOR&gt;]& lhs,
    xref:BloombergLP/bslstl/HashTable_ComparatorWrapper-0e.adoc[HashTable&lowbar;ComparatorWrapper&lt;FUNCTOR&gt;]& rhs);
----

[.small]#xref:BloombergLP/bslstl/swap-044.adoc[_» more&period;&period;&period;_]#

Swap the functor wrapped by the specified `a` object with the functor wrapped by the specified `b` object&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class FUNCTOR&gt;
void
xref:BloombergLP/bslstl/swap-040.adoc[swap](
    xref:BloombergLP/bslstl/HashTable_HashWrapper-03.adoc[HashTable&lowbar;HashWrapper&lt;FUNCTOR&gt;]& a,
    xref:BloombergLP/bslstl/HashTable_HashWrapper-03.adoc[HashTable&lowbar;HashWrapper&lt;FUNCTOR&gt;]& b);
----

[.small]#xref:BloombergLP/bslstl/swap-040.adoc[_» more&period;&period;&period;_]#

Efficiently exchange the nodes of the specified `a` object with those of the specified `b` object&period; This method provides the no&hyphen;throw exception&hyphen;safety guarantee&period; The behavior is undefined unless `a&period;allocator() &equals;&equals; b&period;allocator()`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class VALUE,
    class ALLOCATOR&gt;
void
xref:BloombergLP/bslstl/swap-0ee.adoc[swap](
    xref:BloombergLP/bslstl/BidirectionalNodePool.adoc[BidirectionalNodePool&lt;VALUE, ALLOCATOR&gt;]& a,
    xref:BloombergLP/bslstl/BidirectionalNodePool.adoc[BidirectionalNodePool&lt;VALUE, ALLOCATOR&gt;]& b);
----

[.small]#xref:BloombergLP/bslstl/swap-0ee.adoc[_» more&period;&period;&period;_]#

Efficiently exchange the values of the specified `a` and `b` objects&period; This function provides the no&hyphen;throw exception&hyphen;safety guarantee&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class KEY,
    class COMPARATOR&gt;
void
xref:BloombergLP/bslstl/swap-0a.adoc[swap](
    xref:BloombergLP/bslstl/SetComparator.adoc[SetComparator&lt;KEY, COMPARATOR&gt;]& a,
    xref:BloombergLP/bslstl/SetComparator.adoc[SetComparator&lt;KEY, COMPARATOR&gt;]& b);
----

[.small]#xref:BloombergLP/bslstl/swap-0a.adoc[_» more&period;&period;&period;_]#

Efficiently exchange the values of the specified `a` and `b` objects&period; This function provides the no&hyphen;throw exception&hyphen;safety guarantee&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class KEY,
    class VALUE,
    class COMPARATOR&gt;
void
xref:BloombergLP/bslstl/swap-015.adoc[swap](
    xref:BloombergLP/bslstl/MapComparator-0d.adoc[MapComparator&lt;KEY, VALUE, COMPARATOR&gt;]& a,
    xref:BloombergLP/bslstl/MapComparator-0d.adoc[MapComparator&lt;KEY, VALUE, COMPARATOR&gt;]& b);
----

[.small]#xref:BloombergLP/bslstl/swap-015.adoc[_» more&period;&period;&period;_]#

Swap both the value, the hasher, the comparator, and the `maxLoadFactor` of the specified `x` object with the value, the hasher, the comparator, and the `maxLoadFactor` of the specified `y` object&period; Additionally, if `bslstl&colon;&colon;AllocatorTraits&lt;ALLOCATOR&gt;&colon;&colon;propagate&lowbar;on&lowbar;container&lowbar;swap` is `true`, then exchange the allocator of `x` with that of `y`, and do not modify either allocator otherwise&period; This method guarantees `O&lsqb;1&rsqb;` complexity if `x` and `y` have the same allocator or if the allocators propagate on swap, otherwise this operation will typically pay the cost of two copy constructors, which may in turn throw&period; If the allocators are the same or propagate, then this method provides the no&hyphen;throw exception&hyphen;safety guarantee unless the `swap` function of the hasher or comparator throw&period; Otherwise this method offers only the basic exception safety guarantee&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class KEY&lowbar;CONFIG,
    class HASHER,
    class COMPARATOR,
    class ALLOCATOR&gt;
void
xref:BloombergLP/bslstl/swap-0e8.adoc[swap](
    xref:BloombergLP/bslstl/HashTable-06.adoc[HashTable&lt;KEY&lowbar;CONFIG, HASHER, COMPARATOR, ALLOCATOR&gt;]& x,
    xref:BloombergLP/bslstl/HashTable-06.adoc[HashTable&lt;KEY&lowbar;CONFIG, HASHER, COMPARATOR, ALLOCATOR&gt;]& y);
----

[.small]#xref:BloombergLP/bslstl/swap-0e8.adoc[_» more&period;&period;&period;_]#


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