I have a template class. Since the templates are processed during compile time, is it possible to compare the template parameter during compile time and use the preprocessor to add specific code? Something like this:
template<class T>
class MyClass
{
public:
void do()
{
#if T is equal to vector<int>
// add vector<int> specific code
#if T is equal to list<double>
// add list<double> specific code
#else
cout << "Unsupported data type" << endl;
#endif
}
};
How can I compare the template types to another type during compile time as shown in the example above? I do not want to add specific subclasses that handle specific types.