Update of /cvsroot/boost/boost/boost/graph
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17617/boost/graph

Modified Files:
      Tag: RC_1_34_0
        relax.hpp 
Log Message:
Fix handling of overflow in shortest-path algorithms

Index: relax.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/graph/relax.hpp,v
retrieving revision 1.25
retrieving revision 1.25.2.1
diff -u -d -r1.25 -r1.25.2.1
--- relax.hpp   6 Feb 2006 22:12:57 -0000       1.25
+++ relax.hpp   29 May 2007 16:53:05 -0000      1.25.2.1
@@ -22,16 +22,13 @@
     template <class T>
     struct closed_plus
     {
-      // std::abs just isn't portable :(
-      template <class X>
-      inline X my_abs(const X& x) const { return x < 0 ? -x : x; }
-
       T operator()(const T& a, const T& b) const {
         using namespace std;
-        T inf = (numeric_limits<T>::max)();
-        if (b > 0 && my_abs(inf - a) < b)
-          return inf;
-        return a + b;
+       T zero(0);
+       T result = a + b;
+       if (result < zero && a >= zero && b >= zero)
+         return (numeric_limits<T>::max)();
+       return result;
       }
     };
     


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to