bsl::Variant_VariantAlternativeImpl

This component-private metafunction provides the implementation of bsl::variant_alternative.

Synopsis

Declared in <bslstl_variant.h>

template<
    std::size_t t_INDEX,
    class t_HEAD = BSLSTL_VARIANT_NOT_A_TYPE,
    class... t_TAIL>
struct Variant_VariantAlternativeImpl
    : Variant_VariantAlternativeImpl<t_INDEX - 1, t_TAIL...>

Description

It recursively strips one type from the front of (template parameters) t_HEAD, t_TAIL... for each decrement of (template parameter) t_INDEX until t_INDEX reaches 0, at which point the resulting t_HEAD is the alternative type.

Base Classes

NameDescription
Variant_VariantAlternativeImpl<t_INDEX - 1, t_TAIL...>This component-private metafunction provides the implementation of bsl::variant_alternative.

Specializations

NameDescription
Variant_VariantAlternativeImpl<0, BSLSTL_VARIANT_NOT_A_TYPE> This explicit specialization handles the case of an empty alternative list queried at index 0. No member typedef is provided.
Variant_VariantAlternativeImpl<t_INDEX, BSLSTL_VARIANT_NOT_A_TYPE> This partial specialization is used when the list of alternatives is exhausted before t_INDEX reaches 0, i.e., t_INDEX is out of range.
Variant_VariantAlternativeImpl<0, t_HEAD, t_TAIL...> This partial specialization is the base case of the recursion, reached when t_INDEX is 0; it provides the member typedef type equal to t_HEAD.

Derived Classes

NameDescription
Variant_VariantAlternativeImpl This component-private metafunction provides the implementation of bsl::variant_alternative.
variant_alternative<t_INDEX, variant<t_HEAD, t_TAIL...>> Compute the alternative type at index t_INDEX of a bsl::variant.