[#BloombergLP-bdlb-Variant11-2constructor-01d]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlb.adoc[bdlb]::xref:BloombergLP/bdlb/Variant11.adoc[Variant11]::Variant11
:relfileprefix: ../../../
:mrdocs:

Constructors

== Synopses

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

Create a variant object in the unset state that uses the currently installed default allocator to supply memory&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlb/Variant11/2constructor-059.adoc[Variant11]();
----

[.small]#xref:BloombergLP/bdlb/Variant11/2constructor-059.adoc[_» more&period;&period;&period;_]#

Create a variant by moving from `original`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlb/Variant11/2constructor-00.adoc[Variant11](xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef&lt;Variant11&gt;] original);
----

[.small]#xref:BloombergLP/bdlb/Variant11/2constructor-00.adoc[_» more&period;&period;&period;_]#

Create a variant from `valueOrAllocator`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TYPE&lowbar;OR&lowbar;ALLOCATOR&gt;
explicit
xref:BloombergLP/bdlb/Variant11/2constructor-050.adoc[Variant11](TYPE&lowbar;OR&lowbar;ALLOCATOR const& valueOrAllocator);
----

[.small]#xref:BloombergLP/bdlb/Variant11/2constructor-050.adoc[_» more&period;&period;&period;_]#

Create a variant by moving from the specified `value`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TYPE&gt;
explicit
xref:BloombergLP/bdlb/Variant11/2constructor-0a.adoc[Variant11](TYPE&& value)
requires !bsl&colon;&colon;is&lowbar;same&lt;
                      SelfType,
                      typename bsl&colon;&colon;remove&lowbar;const&lt;
                      typename bsl&colon;&colon;remove&lowbar;reference&lt;TYPE&gt;&colon;&colon;type&gt;&colon;&colon;type&gt;&colon;&colon;value
                  &amp;&amp;
                  !bsl&colon;&colon;is&lowbar;convertible&lt;TYPE, bslma&colon;&colon;Allocator &ast;&gt;&colon;&colon;value;
----

[.small]#xref:BloombergLP/bdlb/Variant11/2constructor-0a.adoc[_» more&period;&period;&period;_]#

Create a variant holding `value` using `basicAllocator`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TYPE&gt;
xref:BloombergLP/bdlb/Variant11/2constructor-07.adoc[Variant11](TYPE&& value)
requires !bsl&colon;&colon;is&lowbar;same&lt;
                     SelfType,
                     typename bsl&colon;&colon;remove&lowbar;const&lt;
                     typename bsl&colon;&colon;remove&lowbar;reference&lt;TYPE&gt;&colon;&colon;type&gt;&colon;&colon;type&gt;&colon;&colon;value;
----

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

Create a variant from `original` using `basicAllocator`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlb/Variant11/2constructor-0b.adoc[Variant11](
    xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef&lt;Variant11&gt;] original,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator);
----

[.small]#xref:BloombergLP/bdlb/Variant11/2constructor-0b.adoc[_» more&period;&period;&period;_]#

Create a variant with the type and value of `original`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlb/Variant11/2constructor-0e.adoc[Variant11](
    xref:BloombergLP/bdlb/Variant11.adoc[Variant11] const& original,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0);
----

[.small]#xref:BloombergLP/bdlb/Variant11/2constructor-0e.adoc[_» more&period;&period;&period;_]#

Create a variant holding `value` using `basicAllocator`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TYPE&gt;
xref:BloombergLP/bdlb/Variant11/2constructor-010.adoc[Variant11](
    TYPE const& value,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator);
----

[.small]#xref:BloombergLP/bdlb/Variant11/2constructor-010.adoc[_» more&period;&period;&period;_]#

== Parameters

[cols="1,4"]
|===
| Name| Description
| *original*
| source variant to copy or move from
| *valueOrAllocator*
| held value, or allocator if convertible to `bslma&colon;&colon;Allocator &ast;`
| *value*
| value assigned to or stored in this variant
| *basicAllocator*
| allocator used to supply memory
|===


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