Macro Subspace :: sus_choice_types

A macro used to declare the value-type pairings in a Choice. See the Choice type for examples of its use.

Constructs a set of associated value and types pairings. The type of the values need have no relationship to the specified types.

Details

The input takes the format: (Value1, Type1A, Type1B), (Value2, Type2), ... The output is the sequence TypeList<Tuple<Type1A, Type1B>, Tuple<Type2>, ...>, Value1, Value2, .... Use sus::macros::value_types::TypeAt<I, Types<...>> to extract each tuple type from the returned set of types.

The number of values that follow will always be the same as the number of types in the set. This is the primary value of the sus_choice_types() construct.

Example

template <class Types, auto FirstValue, auto... Values>
class Example {
  using first_type = v<0, Types>;
  static constexpr auto first_value = FirstValue;
};

using E = Example<sus_choice_types(('h', i32), ('w', f32))>;
// `E::first_value` will be `'h'` of type `char`.
// `E::first_type` will be `Tuple<i32>`.