From 95ca0754f5edda73da017d3eda256a3e7fc4c2f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 6 Aug 2012 17:56:29 +0200 Subject: [PATCH] Hide MathTypeTraits implementation in Implementation namespace. --- src/Math/MathTypeTraits.h | 42 ++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 18 deletions(-) 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