Possible Duplicate:
partial specialization of function template
I can't find anywhere a solution for my problem, because if I search with the keywords I come up with would give me solutions suited for different problems. I understand that this must been asked before, just can't find a solution.
Suppose I have a function template:
template<class any> print(any value);
I can specialize it like this for let's say a int
:
template<> print<int>(int value)
{
std::cout << value;
}
But now the problem, I want it to work with a vector as well. Since the vector class is a template class it becomes difficult.
Specializing the function like this:
template<class any> print<vector<any> >(vector<any> value) {}
Will generate the following error (MinGW g++):
FILE: error: function template partial specialization 'print<vector<any> >' is not allowed
Note that the function print is just an example.
How can I solve this?