maths: add is_nan for arbitrary types
This commit is contained in:
parent
5bb55f5437
commit
6f4bc6d6b2
24
maths.hpp
24
maths.hpp
@ -176,6 +176,30 @@ namespace util {
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
constexpr
|
||||
typename std::enable_if_t<
|
||||
std::is_floating_point<T>::value, bool
|
||||
>
|
||||
is_nan (T t)
|
||||
{
|
||||
return std::isnan (t);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
constexpr
|
||||
typename std::enable_if_t<
|
||||
!std::is_floating_point<T>::value, bool
|
||||
>
|
||||
is_nan (const T&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
T
|
||||
|
Loading…
Reference in New Issue
Block a user