I don\'t understand the error message when trying to pass a variable number of initializer lists:
template
void foo(Values...)
{
}
The problem is indeed deducibility, as mentioned by other answers. Instead of providing a second function taking an initializer_list, you may specify the type of the argument to foo when calling the function:
#include
template
void foo(Values...)
{
}
int main()
{
foo(1, 2, 3, "hello", 'a');
foo(std::initializer_list{1}, std::initializer_list{2, 3});
}
Deciding how to treat each parameter, is another question, however.
[EDIT]: Idea is taken from std::shared_ptr and initializer lists