I want to specialize a particular function for Integer datatype inside a class template. My XX.h will be
Can someone provide me XX.cpp which has template specialization for the function doSomething on Integer datatype.
I tried the following in XX.cpp
But this code is not working, can someone help me.
Code:
namespace ZZ
{
template <class T>
class XX
{
void doSomething(T x);
};
}
I tried the following in XX.cpp
Code:
#include "XX.h"
using namespace ZZ;
template <class T>
void XX<T>::doSomething(T x)
{
// Do somtehing with a generic T
}
template <>
void XX<int>::doSomething(int v)
{
// Do somtehing with int
}
Comment