Is it possible to build only some part of the code given the type of the template in C++ ? It would be something lake that :
#include
using
You use template specification to specify versions of your function to work differently based on its type. For example, you can make a generic version of a function that would work with most types, and make a specific version for e.g. int that will be faster. You'd do it this way:
template
void printType(T param)
{
cout<<"Generic version"<
void printType(int param)
{
cout<<"Int version"<
void printType(char param)
{
cout<<"Char version"<