Your List
is a class template (not template class / struct, it is not a class). You cannot pass a template to a function. You can only pass objects of some type to a function. List
is not a type. List<double>
for example is a type. So you could do for example:
void palindrome(List<double> L);
However, I suppose you want to pass any instantation of List
to the function, eg a List<double>
or a List<int>
etc. Then you can make the function itself a function template:
template <typename T>
template void palindrome(List<T> l);
Note that this is not a function that accepts any instanatiation of List
. It is just a template, and calling it with a List<int>
or a List<double>
will instantiate two distinct functions.
Sometimes it is simpler to be more generic, and you can do as well
template <typename L>
template void palindrome(L l);