Compute t_INDEX + i where i is the index of t_TYPE, or npos.

Synopsis

Declared in <bslstl_variant.h>

template<
    size_t t_INDEX,
    class t_TYPE,
    class t_HEAD = BSLSTL_VARIANT_NOT_A_TYPE,
    class... t_TAIL>
struct Variant_TypeToIndexImpl
    : bsl::conditional<bsl::is_same<t_TYPE, t_HEAD>::value, bsl::integral_constant<size_t, t_INDEX>, Variant_TypeToIndexImpl<t_INDEX + 1, t_TYPE, t_TAIL...>>::type

Description

This component‐private metafunction provides implementation for Variant_TypeToIndex.

It evaluates to t_INDEX + i where i is the zero‐based index of (template parameter) t_TYPE in (template parameters) t_HEAD, t_TAIL..., or bsl::variant_npos if t_TYPE is not found.

Base Classes

Name

Description

bsl::conditional<bsl::is_same<t_TYPE, t_HEAD>::value, bsl::integral_constant<size_t, t_INDEX>, Variant_TypeToIndexImpl<t_INDEX + 1, t_TYPE, t_TAIL...>>::type

Specializations

Name

Description

Variant_TypeToIndexImpl<t_INDEX, t_TYPE, BSLSTL_VARIANT_NOT_A_TYPE>

Handle the case where t_TYPE was not found in the alternative list.

Derived Classes

Name

Description

Variant_TypeToIndex<t_TYPE, bsl::variant<t_HEAD, t_TAIL...>>

Compute the zero‐based index of t_TYPE in a bsl::variant.

Created with MrDocs