C++ – partial specialization of function template

c

Can anybody explain why partial specialization is not valid for function template but it's fine for class template.

I understand partial specialization might make the compiler get confused with function overloading, but I still need more information to make me totally understand. Can anybody offer me some neat examples?

Best Answer

Getting confused is enough of a reason, in this case.

And there's an existing alternative solution: overloading. The committee spent a lot of effort (it seems to me, I wasn't there) getting function overload resolution working for templates, and surely part of the reason for that included not having to solve the less-general, hard problem of function template partial specialization.