Constructors

Synopses

Declared in <bslstl_variant.h>

Create a Variant_Base object holding the 0th alternative, which is value‐initialized.

Create a Variant_Base object holding the same alternative (if any) as the specified original object.

Variant_Base(Variant_Base const& original);

Create a Variant_Base object holding the same alternative (if any) held by the specified original.

Variant_Base(Variant_Base&& original);

Create a Variant_Base object whose index is the specified index without constructing an alternative object.

Variant_Base(
    Variant_ConstructFromStdTag fromStdTag,
    size_t index);

Create a Variant_Base object holding the 0th alternative, which is value‐initialized.

Variant_Base(
    std::allocator_arg_t allocatorArg,
    allocator_type allocator);

Create a Variant_Base object holding the alternative with index (template parameter) t_INDEX, direct‐initialized from the specified args.

template<
    size_t t_INDEX,
    class... t_ARGS>
explicit
Variant_Base(
    bsl::in_place_index_t<t_INDEX> inPlaceIndex,
    t_ARGS&&... args);

Create a Variant_Base object holding the same alternative (if any) held by the specified original object.

Variant_Base(
    std::allocator_arg_t allocatorArg,
    allocator_type allocator,
    Variant const& original);

See the corresponding copy constructor above.

Variant_Base(
    std::allocator_arg_t allocatorArg,
    allocator_type allocator,
    Variant&& original);

Create a Variant_Base object whose index is the specified index without constructing an alternative object.

Variant_Base(
    std::allocator_arg_t allocatorArg,
    allocator_type allocator,
    Variant_ConstructFromStdTag fromStdTag,
    size_t index);

Create a Variant_Base object holding the alternative with index (template parameter) t_INDEX, direct‐initialized from the specified args.

template<
    size_t t_INDEX,
    class... t_ARGS>
explicit
Variant_Base(
    std::allocator_arg_t allocatorArg,
    allocator_type allocator,
    bsl::in_place_index_t<t_INDEX> inPlaceIndex,
    t_ARGS&&... args);

Parameters

Name

Description

original

object to copy

fromStdTag

tag selecting this indexless construction overload

index

index of the alternative that will (later) be created

allocatorArg

tag selecting the allocator‐extended overload

allocator

allocator used to supply memory

inPlaceIndex

tag selecting the in‐place‐index constructor

args

arguments forwarded to the alternative's constructor

Created with MrDocs