diff --git a/Application/src/commons/common/misc/math.h b/Application/src/commons/common/misc/math.h index 8f8657a38a32e51c289da4fbbe9760e61fd8ff3f..fda8c982a5703de8ba14574ada16e5ad8ae2672b 100644 --- a/Application/src/commons/common/misc/math.h +++ b/Application/src/commons/common/misc/math.h @@ -114,14 +114,13 @@ namespace cmn { } template<typename T, typename K = typename std::remove_reference<typename std::remove_cv<T>::type>::type> - constexpr inline auto abs(T&& x) - -> typename std::enable_if< std::is_integral< K >::value || std::is_floating_point< K >::value, K >::type + constexpr inline auto abs(T&& x, typename std::enable_if_t< std::is_arithmetic<K>::value> * = NULL) { - return std::copysign(std::forward<T>(x), static_cast<K>(1)); + return std::abs(std::forward<T>(x)); } template<typename T> - inline T abs(const T& x, typename std::enable_if< !std::is_integral<T>::value && !std::is_floating_point<T>::value, bool>::type* = NULL) { + inline T abs(const T& x, typename std::enable_if< !std::is_arithmetic<T>::value, bool>::type* = NULL) { return T(cmn::abs(x.x), cmn::abs(x.y)); }