I’m trying to create a recursive parameter pack function as follows:
template <class T, class ... Ts>
void myFunction()
{
execute<T>();
myFunction<Ts...>();
}
This doesn’t compile with the error:
error C2672: 'Test::myFunction': no matching overloaded function found.
Does anyone know how to do what I’m trying to achieve?
Thanks
>Solution :
If you can use C++17 or newer, you can skip the recursion and use a fold expression like
template<class... Ts>
void myFunction()
{
(execute<Ts>(), ...);
}