Using C++26's pack indexing, you can create a simple tuple of types like so:
template <typename... Ts>
struct type_tuple {
template <unsigned Index>
using get = Ts...[Index];
};
using T = type_tuple<int, float, double>::get<1>; // float
How can this be replicated in earlier C++ versions?
You can use std::tuple_element
. This will work in all C++ versions supporting parameter packs:
template <typename... Ts>
struct type_tuple {
template <std::size_t Index>
using get = typename std::tuple_element<Index, std::tuple<Ts...>>::type;
};