Create a variant object holding the t_INDEX alternative from il and args using allocator.

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
explicit
variant(
    std::allocator_arg_t allocatorArg,
    allocator_type allocator,
    bsl::in_place_index_t<t_INDEX> inPlaceIndex,
    std::initializer_list<INIT_LIST_TYPE> il,
    t_ARGS&&... args);

Description

Create a variant object holding the alternative with index (template parameter) t_INDEX, direct‐initialized from the specified il and args. If this variant is allocator‐aware, the specified allocator is used to supply memory. This constructor participates in overload resolution only if t_INDEX is a valid alternative index and the designated alternative is constructible from il and args.

Parameters

Name

Description

allocatorArg

tag selecting the allocator‐extended overload

allocator

allocator used to supply memory

inPlaceIndex

tag selecting the t_INDEX alternative

il

initializer list used to construct the selected alternative

args

additional arguments used to construct the alternative

Created with MrDocs