I have this code in header
class MyMathUtils {
template <typename T> static bool IsEqual(const T & val1, const T & val2);
};
template <typename T>
bool MyMathUtils::IsEqual(const T & val1, const T & val2)
{
return (val1 == val2);
};
And this in cpp
template <>
bool MyMathUtils::IsEqual<float>(const float & val1, const float & val2)
{
if ((val1 - val2) < -EPSILON) return false;
if ((val1 - val2) > EPSILON) return false;
return true;
}
Problem is, that compiler gives me this error:
MyMath::MyMathUtils::IsEqual(float const &,float const &)" (??$IsEqual@M@MyMathUtils@MyMath@@SA_NABM0@Z) already defined in MyMathUtils.obj; second definition ignored
But if I use the same, but instead of float I put double, it is compiled correctly. What is incorrect here, that I am missing?