diff --git a/src/Math/MathTypeTraits.h b/src/Math/MathTypeTraits.h index c1a989f8a..4330491e5 100644 --- a/src/Math/MathTypeTraits.h +++ b/src/Math/MathTypeTraits.h @@ -79,39 +79,45 @@ template struct MathTypeTraits { */ #ifndef DOXYGEN_GENERATING_OUTPUT -template struct _MathTypeTraitsIntegral { +namespace Implementation { + +template struct MathTypeTraitsIntegral { inline constexpr static T epsilon() { return 1; } inline constexpr static bool equals(T a, T b) { return a == b; } }; -template<> struct MathTypeTraits: public _MathTypeTraitsIntegral {}; -template<> struct MathTypeTraits: public _MathTypeTraitsIntegral {}; -template<> struct MathTypeTraits: public _MathTypeTraitsIntegral {}; -template<> struct MathTypeTraits: public _MathTypeTraitsIntegral {}; +template struct MathTypeTraitsFloatingPoint { + inline static bool equals(T a, T b) { + return std::abs(a - b) < MathTypeTraits::epsilon(); + } +}; + +} -template<> struct MathTypeTraits: public _MathTypeTraitsIntegral {}; -template<> struct MathTypeTraits: public _MathTypeTraitsIntegral {}; +template<> struct MathTypeTraits: public Implementation::MathTypeTraitsIntegral {}; +template<> struct MathTypeTraits: public Implementation::MathTypeTraitsIntegral {}; + +template<> struct MathTypeTraits: public Implementation::MathTypeTraitsIntegral {}; +template<> struct MathTypeTraits: public Implementation::MathTypeTraitsIntegral {}; + +template<> struct MathTypeTraits: public Implementation::MathTypeTraitsIntegral {}; +template<> struct MathTypeTraits: public Implementation::MathTypeTraitsIntegral {}; /* long is 32 bits somewhere and 64 bits elsewhere, so it cannot be mapped to any of them */ -template<> struct MathTypeTraits: public _MathTypeTraitsIntegral {}; -template<> struct MathTypeTraits: public _MathTypeTraitsIntegral {}; +template<> struct MathTypeTraits: public Implementation::MathTypeTraitsIntegral {}; +template<> struct MathTypeTraits: public Implementation::MathTypeTraitsIntegral {}; -template<> struct MathTypeTraits: public _MathTypeTraitsIntegral {}; -template<> struct MathTypeTraits: public _MathTypeTraitsIntegral {}; +template<> struct MathTypeTraits: public Implementation::MathTypeTraitsIntegral {}; +template<> struct MathTypeTraits: public Implementation::MathTypeTraitsIntegral {}; -template struct _MathTypeTraitsFloatingPoint { - inline static bool equals(T a, T b) { - return std::abs(a - b) < MathTypeTraits::epsilon(); - } -}; -template<> struct MathTypeTraits: public _MathTypeTraitsFloatingPoint { +template<> struct MathTypeTraits: public Implementation::MathTypeTraitsFloatingPoint { inline constexpr static float epsilon() { return FLOAT_EQUALITY_PRECISION; } }; -template<> struct MathTypeTraits: public _MathTypeTraitsFloatingPoint { +template<> struct MathTypeTraits: public Implementation::MathTypeTraitsFloatingPoint { inline constexpr static double epsilon() { return DOUBLE_EQUALITY_PRECISION; } }; #endif