Partial specialization of a method in a templated class
问题 Given: struct A { virtual bool what() = 0; }; template<typename T, typename Q> struct B : public A { virtual bool what(); }; I want to partially specialize what like: template<typename T, typename Q> bool B<T, Q>::what() { return true; } template<typename Q> bool B<float, Q>::what() { return false; } But it appears that this isn't possible (is it in C++11?) so I tried SFINAE: template<typename T> typename std::enable_if<std::is_same<T, float>::value, bool>::type B<T>::what() { return true; }