I believe this:
// specialization for vector
template< class T >
void f<>( const std::vector<T> & v )
{
cout << "vector" << endl;
}
is not possible (even if your syntax were corrected, as Anton did in his answer), because it is not a full specialization of f
(there are unbound type parameters). Partial function specialization is not allowed under the C++ standard.
There are a few other questions on Stack Overflow involving similar code with similar issues. This one (and the winning answer) seems to be quite relevant: Why function template cannot be partially specialized?
You can peruse the C++ standards for yourself, if you were feeling particularly masochistic. You might start from section 14.7.3 ("Explicit specialization") at page 368 of this document: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf (which is a semi-recent draft, but not the most up to date. It is free, however.)