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

Create a `variant` object holding the alternative with index (template parameter) `t&lowbar;INDEX`, direct&hyphen;initialized from the specified `il` and `args`&period; If this `variant` is allocator&hyphen;aware, the currently installed default allocator is used to supply memory&period; This constructor participates in overload resolution only if `t&lowbar;INDEX` is a valid alternative index and the designated alternative is constructible from `il` and `args`&period; For simplicity of implementation, this method differs from the standard in the following way&colon; &ast; `constexpr` is not implemented

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    std::size&lowbar;t t&lowbar;INDEX,
    class INIT&lowbar;LIST&lowbar;TYPE,
    class&period;&period;&period; t&lowbar;ARGS&gt;
requires (t&lowbar;INDEX &lt; 1 &plus; sizeof&period;&period;&period;(t&lowbar;TAIL)) &amp;&amp;
                  std&colon;&colon;is&lowbar;constructible&lt;BSLSTL&lowbar;VARIANT&lowbar;TYPE&lowbar;AT&lowbar;INDEX(t&lowbar;INDEX),
                                        std&colon;&colon;initializer&lowbar;list&lt;INIT&lowbar;LIST&lowbar;TYPE&gt;&amp;,
                                        t&lowbar;ARGS&period;&period;&period;&gt;&colon;&colon;value
explicit
variant(
    bsl::in&lowbar;place&lowbar;index&lowbar;t&lt;t&lowbar;INDEX&gt;,
    std::initializer&lowbar;list&lt;INIT&lowbar;LIST&lowbar;TYPE&gt; il,
    t&lowbar;ARGS&&&period;&period;&period; args);
----


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