Build tuple from heterogeneous initializer list at function call

Viewed 1249

Consider the following function

template <class... T, class... U>
void f(std::tuple<T...> t, std::tuple<U...> u)
{
    std::cout << sizeof...(T) << " " << sizeof...(U) << std::endl;
}

int main(int argc, char* argv[]) 
{
    f({3, 3.5, "Hello World!"}, {'a', std::string("b")}); // Fails
    return 0;
}

Would there be any way in C++17 to modify the function signature so that the line marked "Fails" would work? (keeping that line the same).

2 Answers
Related