I have defined a typelist like this:
template <typename ... Types> struct typelist {};
using my_list = typelist<int, double, bool, float>;
Now I have a function template, e.g.
template<typename T>
void foo() {
std::cout << typeid(T).name() << std::endl;
}
and want to call this for every type in the typelist:
foo<int>();
foo<double>();
foo<bool>();
foo<float>();
I tried to find a recursive way to solve this, but I am having trouble to define the correct, probably nested, variadic templates for the required foo functions. Do you have any hints for a neat solution to this problem?