[#BloombergLP-bslstl-Variant_Base-2constructor-08d]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/Variant_Base.adoc[Variant&lowbar;Base]::Variant&lowbar;Base
:relfileprefix: ../../../
:mrdocs:

Constructors

== Synopses

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

Create a `Variant&lowbar;Base` object holding the 0th alternative, which is value&hyphen;initialized&period; If this `Variant&lowbar;Base` is allocator&hyphen;aware, the currently installed default allocator is used to supply memory&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/Variant_Base/2constructor-00.adoc[Variant&lowbar;Base]();
----

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

Create a `Variant&lowbar;Base` object holding the same alternative (if any) as the specified `original` object&period; If this `Variant&lowbar;Base` is allocator&hyphen;aware, the currently installed default allocator is used to supply memory&period; If the `original` object is not valueless by exception&apos;, the contained value is copy&hyphen;constructed from the contained value of `original`&period; All alternatives shall be copy constructible&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/Variant_Base/2constructor-0f.adoc[Variant&lowbar;Base](xref:BloombergLP/bslstl/Variant_Base.adoc[Variant&lowbar;Base] const& original);
----

[.small]#xref:BloombergLP/bslstl/Variant_Base/2constructor-0f.adoc[_» more&period;&period;&period;_]#

Create a `Variant&lowbar;Base` object holding the same alternative (if any) held by the specified `original`&period; If this `Variant&lowbar;Base` is allocator&hyphen;aware, the allocator of `original` is used to supply memory&period; If the `original` object is not valueless by exception, the contained value is move&hyphen;constructed from the contained value of `original`&period; All alternatives shall be move constructible&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/Variant_Base/2constructor-0b9.adoc[Variant&lowbar;Base](xref:BloombergLP/bslstl/Variant_Base.adoc[Variant&lowbar;Base]&& original);
----

[.small]#xref:BloombergLP/bslstl/Variant_Base/2constructor-0b9.adoc[_» more&period;&period;&period;_]#

Create a `Variant&lowbar;Base` object whose index is the specified `index` without constructing an alternative object&period; If this `Variant&lowbar;Base` is allocator&hyphen;aware, the default allocator is used to supply memory&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/Variant_Base/2constructor-05.adoc[Variant&lowbar;Base](
    xref:BloombergLP/bslstl/Variant_ConstructFromStdTag.adoc[Variant&lowbar;ConstructFromStdTag],
    size&lowbar;t index);
----

[.small]#xref:BloombergLP/bslstl/Variant_Base/2constructor-05.adoc[_» more&period;&period;&period;_]#

Create a `Variant&lowbar;Base` object holding the 0th alternative, which is value&hyphen;initialized&period; If this `Variant&lowbar;Base` is allocator&hyphen;aware, the specified `allocator` is used to supply memory&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/Variant_Base/2constructor-0bb.adoc[Variant&lowbar;Base](
    std::allocator&lowbar;arg&lowbar;t,
    xref:BloombergLP/bslstl/Variant_Base/allocator_type.adoc[allocator&lowbar;type] allocator);
----

[.small]#xref:BloombergLP/bslstl/Variant_Base/2constructor-0bb.adoc[_» more&period;&period;&period;_]#

Create a `Variant&lowbar;Base` object holding the alternative with index (template parameter) `t&lowbar;INDEX`, direct&hyphen;initialized from the specified `args`&period; If this `Variant&lowbar;Base` is allocator&hyphen;aware, the currently installed default allocator is used to supply memory&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    size&lowbar;t t&lowbar;INDEX,
    class&period;&period;&period; t&lowbar;ARGS&gt;
explicit
xref:BloombergLP/bslstl/Variant_Base/2constructor-02.adoc[Variant&lowbar;Base](
    bsl::in&lowbar;place&lowbar;index&lowbar;t&lt;t&lowbar;INDEX&gt;,
    t&lowbar;ARGS&&&period;&period;&period; args);
----

[.small]#xref:BloombergLP/bslstl/Variant_Base/2constructor-02.adoc[_» more&period;&period;&period;_]#

Create a `Variant&lowbar;Base` object holding the same alternative (if any) held by the specified `original` object&period; If this `Variant&lowbar;Base` is allocator&hyphen;aware, the specified `allocator` is used to supply memory&period; If the `original` object is not valueless by exception, the contained value is copy&sol;move constructed from the contained value of `original`&period; All alternatives shall be copy&sol;move constructible&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/Variant_Base/2constructor-089.adoc[Variant&lowbar;Base](
    std::allocator&lowbar;arg&lowbar;t,
    xref:BloombergLP/bslstl/Variant_Base/allocator_type.adoc[allocator&lowbar;type] allocator,
    xref:BloombergLP/bslstl/Variant_Base/Variant.adoc[Variant] const& original);
----

[.small]#xref:BloombergLP/bslstl/Variant_Base/2constructor-089.adoc[_» more&period;&period;&period;_]#

See the corresponding copy constructor above&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/Variant_Base/2constructor-0e.adoc[Variant&lowbar;Base](
    std::allocator&lowbar;arg&lowbar;t,
    xref:BloombergLP/bslstl/Variant_Base/allocator_type.adoc[allocator&lowbar;type] allocator,
    xref:BloombergLP/bslstl/Variant_Base/Variant.adoc[Variant]&& original);
----

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

Create a `Variant&lowbar;Base` object whose index is the specified `index` without constructing an alternative object&period; If this `Variant&lowbar;Base` is allocator&hyphen;aware, the specified `allocator` is used to supply memory&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/Variant_Base/2constructor-0b4.adoc[Variant&lowbar;Base](
    std::allocator&lowbar;arg&lowbar;t,
    xref:BloombergLP/bslstl/Variant_Base/allocator_type.adoc[allocator&lowbar;type] allocator,
    xref:BloombergLP/bslstl/Variant_ConstructFromStdTag.adoc[Variant&lowbar;ConstructFromStdTag],
    size&lowbar;t index);
----

[.small]#xref:BloombergLP/bslstl/Variant_Base/2constructor-0b4.adoc[_» more&period;&period;&period;_]#

Create a `Variant&lowbar;Base` object holding the alternative with index (template parameter) `t&lowbar;INDEX`, direct&hyphen;initialized from the specified `args`&period; If this `Variant&lowbar;Base` is allocator&hyphen;aware, the specified `allocator` is used to supply memory&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    size&lowbar;t t&lowbar;INDEX,
    class&period;&period;&period; t&lowbar;ARGS&gt;
explicit
xref:BloombergLP/bslstl/Variant_Base/2constructor-04.adoc[Variant&lowbar;Base](
    std::allocator&lowbar;arg&lowbar;t,
    xref:BloombergLP/bslstl/Variant_Base/allocator_type.adoc[allocator&lowbar;type] allocator,
    bsl::in&lowbar;place&lowbar;index&lowbar;t&lt;t&lowbar;INDEX&gt;,
    t&lowbar;ARGS&&&period;&period;&period; args);
----

[.small]#xref:BloombergLP/bslstl/Variant_Base/2constructor-04.adoc[_» more&period;&period;&period;_]#


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