An easy way to use variadic template functions is with direct recursion:
#include <iostream>
using namespace std;
void foo()
{
// Base case for variadic recursion
}
template<typename T, typename... Args>
void foo(T first, const Args... remaining)
{
// Use the first argument
cout << first << endl;
// Recursively pass on the remaining arguments
foo(remaining...);
}
int main()
{
cout.setf(ios::boolalpha); // To make bool args print right
foo(1, "test", 3.14159, 'Q', true, 6);
}