template class with a single method specialized in C++
问题 I only have an hpp file for a school assignment in C++ (I am not allowed to add a cpp file, declaration and implementation should be both written in the file). I wrote this code inside it: template<class T> class Matrix { void foo() { //do something for a T variable. } }; I would like to add another foo method, but this foo() will be specialized for only an <int> . I have read in some places that I need to declare a new specialization class for this to work. But what I want is that the