[#bsl-variant-2constructor-015]
= xref:bsl.adoc[bsl]::xref:bsl/variant.adoc[variant]::variant
:relfileprefix: ../../
:mrdocs:

Create a `variant` object holding a value&hyphen;initialized 0th alternative using `allocator`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;FIRST = t&lowbar;HEAD&gt;
requires std&colon;&colon;is&lowbar;default&lowbar;constructible&lt;t&lowbar;FIRST&gt;&colon;&colon;value
variant(
    std::allocator&lowbar;arg&lowbar;t allocatorArg,
    xref:bsl/variant/allocator_type.adoc[allocator&lowbar;type] allocator);
----

== Description

Create a `variant` object holding the 0th alternative, which is value&hyphen;initialized&period; If this `variant` is allocator&hyphen;aware, the specified `allocator` is used to supply memory&period; This constructor participates in overload resolution only if the 0th alternative is default constructible&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *allocatorArg*
| tag selecting the allocator&hyphen;extended overload
| *allocator*
| allocator used to supply memory
|===


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