I\'d like to perform similar, but not identical computations for several integer types (16, 32, 64 bits) and floating point types (float, double, long double). Most of the code
You can specialize on
Then you can group functions based on categories
template class isEqualbyType;
template
class isEqualbyType
{
public:
static bool cmp( T a, T b ) {
return a == b; }
};
template
class isEqualbyType
{
public:
static bool cmp( T a, T b ) {
static const double epsilon=1e-50;
return abs( a - b ) < epsilon; }
};
template
bool isEqual( T a, T b )
{
return isEqualbyType::value>::cmp(a,b);
};