bsl::variant::emplace

Create the alternative with index (template parameter) t_INDEX in place, direct-initialized from the specified il and 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 il and 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>

template<
    std::size_t t_INDEX,
    class INIT_LIST_TYPE,
    class... t_ARGS>
requires (t_INDEX < 1 + sizeof...(t_TAIL)) &&
                  std::is_constructible<BSLSTL_VARIANT_TYPE_AT_INDEX(t_INDEX),
                                        std::initializer_list<INIT_LIST_TYPE>&,
                                        t_ARGS...>::value
variant_alternative<t_INDEX, variant<t_HEAD, t_TAIL...>>::type&
emplace(
    std::initializer_list<INIT_LIST_TYPE> il,
    t_ARGS&&... args);