Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85140 - trunk/boost/geometry/strategies/cartesian
From: barend.gehrels_at_[hidden]
Date: 2013-07-23 17:03:35


Author: barendgehrels
Date: 2013-07-23 17:03:35 EDT (Tue, 23 Jul 2013)
New Revision: 85140
URL: http://svn.boost.org/trac/boost/changeset/85140

Log:
[geometry] fixed pythagoras calculation for Windows (MSVC), the problem was that std::sqrt(int) is ambiguous. Previous version did it in two steps, we now use boost::numeric_cast

Text files modified:
   trunk/boost/geometry/strategies/cartesian/distance_pythagoras.hpp | 9 ++++++++-
   1 files changed, 8 insertions(+), 1 deletions(-)

Modified: trunk/boost/geometry/strategies/cartesian/distance_pythagoras.hpp
==============================================================================
--- trunk/boost/geometry/strategies/cartesian/distance_pythagoras.hpp Tue Jul 23 15:49:38 2013 (r85139)
+++ trunk/boost/geometry/strategies/cartesian/distance_pythagoras.hpp 2013-07-23 17:03:35 EDT (Tue, 23 Jul 2013) (r85140)
@@ -155,7 +155,14 @@
     static inline typename calculation_type<P1, P2>::type
     apply(P1 const& p1, P2 const& p2)
     {
- return sqrt(comparable::pythagoras<CalculationType>::apply(p1, p2));
+ // The cast is necessary for MSVC which considers sqrt __int64 as an ambiguous call
+ return std::sqrt
+ (
+ boost::numeric_cast<typename calculation_type<P1, P2>::type>
+ (
+ comparable::pythagoras<CalculationType>::apply(p1, p2)
+ )
+ );
     }
 };
 


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