diff --git a/vector.cpp b/vector.cpp index ea381a04..21d0f326 100644 --- a/vector.cpp +++ b/vector.cpp @@ -86,13 +86,17 @@ template util::vector2d util::to_euler (util::vector3d); /////////////////////////////////////////////////////////////////////////////// template -void -util::vector::sanity (void) const -{ - CHECK (std::all_of (std::begin (this->data), - std::end (this->data), - [] (T i) { return !std::isnan (i); })); -} +struct util::debug::validator> { + static bool + is_valid (vector const& val) + { + return std::all_of ( + std::begin (val.data), + std::end (val.data), + [] (auto v) { return !std::isnan (v); } + ); + } +}; /////////////////////////////////////////////////////////////////////////////// @@ -117,6 +121,7 @@ util::operator>> (const json::tree::node &node, util::vector &v) //----------------------------------------------------------------------------- #define INSTANTIATE_S_T(S,T) \ template struct util::vector; \ +template struct util::debug::validator>; \ template const json::tree::node& util::operator>> (const json::tree::node&, util::vector&); diff --git a/vector.hpp b/vector.hpp index 8763bbef..b0b736fd 100644 --- a/vector.hpp +++ b/vector.hpp @@ -56,8 +56,6 @@ namespace util { // constants static constexpr vector ones (void) { return vector {1}; } static constexpr vector zeros (void) { return vector {0}; } - - void sanity (void) const; }; template