Boost logo

Boost-Commit :

From: pbristow_at_[hidden]
Date: 2007-10-18 07:43:51


Author: pbristow
Date: 2007-10-18 07:43:50 EDT (Thu, 18 Oct 2007)
New Revision: 40152
URL: http://svn.boost.org/trac/boost/changeset/40152

Log:
avoided problems with MSVC macro max and min
Text files modified:
   sandbox/SOC/2007/visualization/boost/svg_plot/detail/numeric_limits_handling.hpp | 25 +++++++++++++------------
   1 files changed, 13 insertions(+), 12 deletions(-)

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/detail/numeric_limits_handling.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/detail/numeric_limits_handling.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/detail/numeric_limits_handling.hpp 2007-10-18 07:43:50 EDT (Thu, 18 Oct 2007)
@@ -1,15 +1,16 @@
-// numeric_limits_handling.hpp
+// numeric_limits_handling.hpp
+
 // Copyright (C) Jacob Voytko 2007
 //
 // Distributed under the Boost Software License, Version 1.0.
 // For more information, see http://www.boost.org
-
 // -----------------------------------------------------------------
 
-#ifndef _BOOST_SVG_NUMERIC_LIMITS_HANDLING_DETAIL_HPP
-#define _BOOST_SVG_NUMERIC_LIMITS_HANDLING_DETAIL_HPP
+#ifndef BOOST_SVG_NUMERIC_LIMITS_HANDLING_DETAIL_HPP
+#define BOOST_SVG_NUMERIC_LIMITS_HANDLING_DETAIL_HPP
 
 #include <limits>
+using std::numeric_limits;
 #include <cmath>
 
 namespace boost{
@@ -18,21 +19,21 @@
 
 inline bool limit_max(double a)
 {
- return (a == std::numeric_limits<double>::max()
+ return (a ==(std::numeric_limits<int>::max)() // Avoid macro max trap!
          || a == std::numeric_limits<double>::infinity());
 }
 
 inline bool limit_min(double a)
 {
- return (a == std::numeric_limits<double>::min()
+ return (a == (std::numeric_limits<int>::min)() // Avoid macro min trap!
         || a == -std::numeric_limits<double>::infinity()
         || a == std::numeric_limits<double>::denorm_min());
 }
 
 inline bool limit_NaN(double a)
 {
- // Ternary operator used to remove warning of performance of casting
- // int to bool.
+ // Ternary operator used to remove warning of casting int to bool.
+ // TODO there is a better way of doing this in the Math Toolkit.
 #if defined (BOOST_MSVC)
     return _isnan(a) ? true : false;
 #else
@@ -51,7 +52,7 @@
         || limit_max(a.second) || limit_min(a.second) || limit_NaN(a.second);
 }
 
-}
-}
-}
-#endif
+} // namespace detail
+} // namespace svg
+} // namespace boost
+#endif // BOOST_SVG_NUMERIC_LIMITS_HANDLING_DETAIL_HPP


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