[#bsl-variant-2constructor-0d0] = xref:bsl.adoc[bsl]::xref:bsl/variant.adoc[variant]::variant :relfileprefix: ../../ :mrdocs: Create a `variant` object holding a `t_TYPE` alternative from `args` using `allocator`. == Synopsis Declared in `<bslstl_variant.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class t_TYPE, class... t_ARGS> requires BSLSTL_VARIANT_HAS_UNIQUE_TYPE(t_TYPE) && std::is_constructible<t_TYPE, t_ARGS...>::value explicit variant( std::allocator_arg_t allocatorArg, xref:bsl/variant/allocator_type.adoc[allocator_type] allocator, bsl::in_place_type_t<t_TYPE> inPlaceType, t_ARGS&&... args); ---- == Description Create a `variant` object holding a contained value of type (template parameter) `t_TYPE`, direct‐initialized from the specified `args`. If this `variant` is allocator‐aware, the specified `allocator `is used to supply memory. This constructor participates in overload resolutionly if `t_TYPE` designates a unique alternative and is constructible from `args`. == Parameters [cols="1,4"] |=== | Name| Description | *allocatorArg* | tag selecting the allocator‐extended overload | *allocator* | allocator used to supply memory | *inPlaceType* | tag selecting the `t_TYPE` alternative | *args* | arguments used to construct the `t_TYPE` alternative |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#