Possible duplicate:
partial specialization of function template
I canโt find a solution for my problem, because if I search for the keywords that I came up with, it will give me solutions that are suitable for different problems. I understand that this should be asked earlier, just canโt find a solution.
Suppose I have a function template:
template<class any> print(any value);
I can specialize it to say a int :
template<> print<int>(int value) { std::cout << value; }
But now the problem is, I want it to work with the vector. Since the vector class is a template class, it becomes difficult.
Specializing in such a function:
template<class any> print<vector<any> >(vector<any> value) {}
It will generate the following error (MinGW g ++):
FILE: error: function template partial specialization 'print<vector<any> >' is not allowed
Note that the print function is just an example.
How can i solve this?
source share