I have refered this link to meet my requirement . But when I am trying to implement the same in my code, it is throwing an error.
template<typename T, typename... Args>
void fun(T t, Args... args)
{
cout << t;
}
int main()
{
fun(1, 2.0, "Ranjan", "hi");//Error happens here
return 0;
}
The error at fun()
is template<class T, <error type>>
What is going wrong here?