[#BloombergLP-bdlb-swap-09]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlb.adoc[bdlb]::swap
:relfileprefix: ../../
:mrdocs:

`swap` overloads

== Synopses

Declared in `&lt;bdlb&lowbar;nullableallocatedvalue&period;h&gt;`

Exchange the values of two nullable objects&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TYPE&gt;
void
xref:BloombergLP/bdlb/swap-07.adoc[swap](
    xref:BloombergLP/bdlb/NullableAllocatedValue.adoc[NullableAllocatedValue&lt;TYPE&gt;]& a,
    xref:BloombergLP/bdlb/NullableAllocatedValue.adoc[NullableAllocatedValue&lt;TYPE&gt;]& b);
----

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

Exchange the values of the specified `lhs` and `rhs` objects&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TYPE&gt;
void
xref:BloombergLP/bdlb/swap-03.adoc[swap](
    xref:BloombergLP/bdlb/NullableValue.adoc[NullableValue&lt;TYPE&gt;]& lhs,
    xref:BloombergLP/bdlb/NullableValue.adoc[NullableValue&lt;TYPE&gt;]& rhs)
requires BloombergLP&colon;&colon;bslma&colon;&colon;UsesBslmaAllocator&lt;TYPE&gt;&colon;&colon;value;
----

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

Exchange the values of the specified `lhs` and `rhs` objects when `TYPE` does not use a `bslma&colon;&colon;Allocator`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TYPE&gt;
void
xref:BloombergLP/bdlb/swap-02.adoc[swap](
    xref:BloombergLP/bdlb/NullableValue.adoc[NullableValue&lt;TYPE&gt;]& lhs,
    xref:BloombergLP/bdlb/NullableValue.adoc[NullableValue&lt;TYPE&gt;]& rhs)
requires !BloombergLP&colon;&colon;bslma&colon;&colon;UsesBslmaAllocator&lt;TYPE&gt;&colon;&colon;value;
----

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

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


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TYPES&gt;
void
xref:BloombergLP/bdlb/swap-04.adoc[swap](
    xref:BloombergLP/bdlb/VariantImp.adoc[VariantImp&lt;TYPES&gt;]& a,
    xref:BloombergLP/bdlb/VariantImp.adoc[VariantImp&lt;TYPES&gt;]& b);
----

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

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 t&lowbar;TYPE,
    unsigned int t&lowbar;NUM&lowbar;BITS&gt;
void
xref:BloombergLP/bdlb/swap-01.adoc[swap](
    xref:BloombergLP/bdlb/NullableAllocatedValue_PointerBitsPair.adoc[NullableAllocatedValue&lowbar;PointerBitsPair&lt;t&lowbar;TYPE, t&lowbar;NUM&lowbar;BITS&gt;]& a,
    xref:BloombergLP/bdlb/NullableAllocatedValue_PointerBitsPair.adoc[NullableAllocatedValue&lowbar;PointerBitsPair&lt;t&lowbar;TYPE, t&lowbar;NUM&lowbar;BITS&gt;]& b);
----

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

Efficiently exchange the values of the specified `a` and `b` objects by applying `swap` to each of the functor and underlying iterator fields of the two objects&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class FUNCTOR,
    class ITERATOR&gt;
void
xref:BloombergLP/bdlb/swap-0d.adoc[swap](
    xref:BloombergLP/bdlb/TransformIterator.adoc[TransformIterator&lt;FUNCTOR, ITERATOR&gt;]& a,
    xref:BloombergLP/bdlb/TransformIterator.adoc[TransformIterator&lt;FUNCTOR, ITERATOR&gt;]& b);
----

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

== Parameters

[cols="1,4"]
|===
| Name| Description
| *a*
| first object to swap
| *b*
| second object to swap
| *lhs*
| left&hyphen;hand operand
| *rhs*
| right&hyphen;hand operand
|===


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