From 43dfbde7fdca49de0c52645dec8e412aca8d0071 Mon Sep 17 00:00:00 2001
From: Tristan Walter <twalter@orn.mpg.de>
Date: Mon, 9 Nov 2020 15:27:09 +0100
Subject: [PATCH] * rely on std::abs

---
 Application/src/commons/common/misc/math.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/Application/src/commons/common/misc/math.h b/Application/src/commons/common/misc/math.h
index 8f8657a..fda8c98 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));
     }
     
-- 
GitLab