[#bsl-variant-emplace-02] = xref:bsl.adoc[bsl]::xref:bsl/variant.adoc[variant]::emplace :relfileprefix: ../../ :mrdocs: Create the alternative with index (template parameter) `t_INDEX` in place, direct‐initialized from the specified `args`, destroying any previously contained value first. Return a reference to the newly created contained value. If the alternative is allocator‐aware, it uses the allocator specified upon the construction of this `variant` object to supply memory; passing an allocator argument to this method results in two allocators being passed to the alternative constructor, resulting in a likely compilation error. If the alternative constructor exits via an exception, this object may be left in the valueless by exception state. This method participates in overload resolution only if `t_INDEX` is a valid alternative index and the designated alternative is constructible from `args`. For simplicity of implementation, this method differs from the standard in the following way: * `constexpr` is not implemented == Synopsis Declared in `<bslstl_variant.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< std::size_t t_INDEX, class... t_ARGS> requires (t_INDEX < 1 + sizeof...(t_TAIL)) && std::is_constructible<BSLSTL_VARIANT_TYPE_AT_INDEX(t_INDEX), t_ARGS...>::value variant_alternative<t_INDEX, variant<t_HEAD, t_TAIL...>>::type& emplace(t_ARGS&&... args); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#