diff --git a/point.cpp b/point.cpp index de0941f0..65facddd 100644 --- a/point.cpp +++ b/point.cpp @@ -48,23 +48,27 @@ util::point::from (point rhs) const /////////////////////////////////////////////////////////////////////////////// -template -void -util::point::sanity (void) const -{ - CHECK (std::all_of (this->begin (), - this->end (), - [] (auto i) { return !std::isnan (i); })); +namespace util::debug { + template + struct validator> { + static bool is_valid (const point &p) + { + // ensure we don't have a nan anywhere + return std::all_of (p.cbegin (), p.cend (), [] (auto i) { + return !(std::is_floating_point::value && std::isnan (i)); + }); + } + }; } - //----------------------------------------------------------------------------- template const util::point util::point::ORIGIN (T {0}); //----------------------------------------------------------------------------- #define INSTANTIATE_S_T(S,T) \ -template struct util::point; +template struct util::point; \ +template bool util::debug::is_valid (const point&); #define INSTANTIATE(T) \ INSTANTIATE_S_T(1,T) \