Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85479 - trunk/boost/geometry/util
From: barend.gehrels_at_[hidden]
Date: 2013-08-26 17:02:18


Author: barendgehrels
Date: 2013-08-26 17:02:18 EDT (Mon, 26 Aug 2013)
New Revision: 85479
URL: http://svn.boost.org/trac/boost/changeset/85479

Log:
[geometry] avoid error on geometry::math::abs for MSVC and long long

Text files modified:
   trunk/boost/geometry/util/math.hpp | 9 +++++----
   1 files changed, 5 insertions(+), 4 deletions(-)

Modified: trunk/boost/geometry/util/math.hpp
==============================================================================
--- trunk/boost/geometry/util/math.hpp Mon Aug 26 16:18:27 2013 (r85478)
+++ trunk/boost/geometry/util/math.hpp 2013-08-26 17:02:18 EDT (Mon, 26 Aug 2013) (r85479)
@@ -218,13 +218,14 @@
 
 /*!
 \brief Short utility to workaround gcc/clang problem that abs is converting to integer
+ and that older versions of MSVC does not support abs of long long...
 \ingroup utility
 */
 template<typename T>
 inline T abs(T const& value)
 {
- using std::abs;
- return abs(value);
+ T const zero = T();
+ return value < zero ? -value : value;
 }
 
 /*!
@@ -232,10 +233,10 @@
 \ingroup utility
 */
 template <typename T>
-static inline int sign(T const& val)
+static inline int sign(T const& value)
 {
     T const zero = T();
- return val > zero ? 1 : val < zero ? -1 : 0;
+ return value > zero ? 1 : value < zero ? -1 : 0;
 }
 
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk