Many questions have been asked, and they are similar to the one I'm going to ask here, but they are not what I think.
I have a template:
namespace app { template <typename T> class MyCLass { public: void dosome(); void doother(); } }
And implementations:
template <typename T> app::MyClass<T>::dosome() {} template <typename T> app::MyClass<T>::doother() {}
When I have an instance of this class that is provided with char
as a template parameter, I want the dosome()
function to behave completely differently. But I just want this function to behave differently, everything else should act the same.
I tried typing:
template<> app::MyCLass<char>::dosome() { }
But the compiler tells me that I'm trying to create a specialization in a different namespace.
So, when I have a code like this:
app::MyCLass<int> a; app::MyCLass<char> b; a.dosome();
In other matters, I saw people creating a completely different specialization of the whole class. But I need only specialization of one method.
Andry source share