Create the t_INDEX alternative in place from il and args.

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);

Description

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

Return Value

reference to the newly created alternative object

Parameters

Name

Description

il

initializer list used to construct the selected alternative

args

additional arguments used to construct the alternative

Created with MrDocs