Why can't you partially specialize a class member function?
问题 Member functions of template classes can be fully specialized, e.g. template<class A> struct MyClass { // Lots of other members int foo(); }; template<class A> MyClass<A>::foo() { return 42; } template<> MyClass<int>::foo() { return 0; } would compile without problems. Note that foo() is not a template function so this is not about template function specialization (I can understand partial specialization is not allowed there as it would become incredibly confusing in combination with