This is lighthearted collection of asymmetries of the C++ language. This is not, in any way, intended as a critic.
§14.5.5 [temp.class.spec] describes the semantic and syntax for class template partial specialization such as, given:
template<typename T, std::size_t I> class X {};
the following are examples of partial specializations:
template<typename T> class X<T, 9> {};
template<typename T, std::size_t I> class X<T*, I> {};
template<std::size_t I> class X<int, I> {};
The same does not hold true for function templates. For example, the following is not valid syntax:
template<typename T, typename S> void func(T, S) {}
template<typename S> void func<int, S>(int, S) {}
For more informations you can read this great SO question.
- All standard quotes refer to draft N4296 which is publicly available here.
- Special thanks go to the folks at Lounge<C++>.