BloombergLP::bslmf::Switch

Compile-time type switch among a variable number of types.

Synopsis

Declared in <bslmf_switch.h>

template<
    size_t t_SWITCH_SELECTOR,
    class... t_TYPES>
struct Switch;

Description

This meta-function, parameterized by an integral t_SWITCH_SELECTOR and types t_T0 up to t_T9, provides a single type alias, Type, which resolves, through specialization for a particular value N of t_SWITCH_SELECTOR, to the type TN, or to Nil if t_SWITCH_SELECTOR is negative or larger than the number of template arguments provided for the types.

Type Aliases

NameDescription
Type Alias to the type selected by t_SWITCH_SELECTOR, or Nil.

Specializations

NameDescription
Switch<0U, t_T0, t_TYPES...> This specialization of Switch for a value of 0 of the parameterized t_SWITCH_SELECTOR selects the parameterized t_T0 as Type.
Switch<1U, t_T0, t_T1, t_TYPES...> This specialization of Switch for a value of 1 of the parameterized t_SWITCH_SELECTOR selects the parameterized t_T1 as Type.
Switch<2U, t_T0, t_T1, t_T2, t_TYPES...> This specialization of Switch for a value of 2 of the parameterized t_SWITCH_SELECTOR selects the parameterized t_T2 as Type.
Switch<3U, t_T0, t_T1, t_T2, t_T3, t_TYPES...> This specialization of Switch for a value of 3 of the parameterized t_SWITCH_SELECTOR selects the parameterized t_T3 as Type.
Switch<4U, t_T0, t_T1, t_T2, t_T3, t_T4, t_TYPES...> This specialization of Switch for a value of 4 of the parameterized t_SWITCH_SELECTOR selects the parameterized t_T4 as Type.
Switch<5U, t_T0, t_T1, t_T2, t_T3, t_T4, t_T5, t_TYPES...> This specialization of Switch for a value of 5 of the parameterized t_SWITCH_SELECTOR selects the parameterized t_T5 as Type.
Switch<6U, t_T0, t_T1, t_T2, t_T3, t_T4, t_T5, t_T6, t_TYPES...> This specialization of Switch for a value of 6 of the parameterized t_SWITCH_SELECTOR selects the parameterized t_T6 as Type.
Switch<7U, t_T0, t_T1, t_T2, t_T3, t_T4, t_T5, t_T6, t_T7, t_TYPES...> This specialization of Switch for a value of 7 of the parameterized t_SWITCH_SELECTOR selects the parameterized t_T7 as Type.
Switch<8U, t_T0, t_T1, t_T2, t_T3, t_T4, t_T5, t_T6, t_T7, t_T8, t_TYPES...> This specialization of Switch for a value of 8 of the parameterized t_SWITCH_SELECTOR selects the parameterized t_T8 as Type.
Switch<9U, t_T0, t_T1, t_T2, t_T3, t_T4, t_T5, t_T6, t_T7, t_T8, t_T9, t_TYPES...> This specialization of Switch for a value of 9 of the parameterized t_SWITCH_SELECTOR selects the parameterized t_T9 as Type.
Switch<t_SWITCH_SELECTOR, t_T0, t_T1, t_T2, t_T3, t_T4, t_T5, t_T6, t_T7, t_T8, t_T9, t_T10, t_TYPES...> Recursing specialization of Switch for selectors of 10 or greater.