diff --git a/maths.hpp b/maths.hpp index 5d9af8e8..b81e96d7 100644 --- a/maths.hpp +++ b/maths.hpp @@ -176,6 +176,30 @@ namespace util { } + //------------------------------------------------------------------------- + template + constexpr + typename std::enable_if_t< + std::is_floating_point::value, bool + > + is_nan (T t) + { + return std::isnan (t); + } + + + //------------------------------------------------------------------------- + template + constexpr + typename std::enable_if_t< + !std::is_floating_point::value, bool + > + is_nan (const T&) + { + return false; + } + + /////////////////////////////////////////////////////////////////////////// template T