How to get an element of type list by index
03:17 16 Jun 2022

How can an element of a type list using L = type_list be retrieved by index, like std::tuple_element, preferrably in a non recursive way?

I want to avoid using tuples as type lists for use cases, that require instantiation for passing a list like f(L{}).

template struct type_list {};
using L = typelist;
using T = typeAt<2, L>; // possible use case

Not sure if an iteration using std::index_sequence and a test via std::is_same of the std::integral_constant version of the index is a good aproach.

c++ metaprogramming variadic-templates c++20