Boost logo

Boost-Commit :

From: hartmut.kaiser_at_[hidden]
Date: 2007-10-28 10:29:41


Author: hkaiser
Date: 2007-10-28 10:29:40 EDT (Sun, 28 Oct 2007)
New Revision: 40527
URL: http://svn.boost.org/trac/boost/changeset/40527

Log:
Changed the code to allow ADL to find the correct pow() function, not relying on an existing overload in the std namespace anymore.
Text files modified:
   trunk/boost/spirit/core/primitives/impl/numerics.ipp | 19 ++++++++-----------
   1 files changed, 8 insertions(+), 11 deletions(-)

Modified: trunk/boost/spirit/core/primitives/impl/numerics.ipp
==============================================================================
--- trunk/boost/spirit/core/primitives/impl/numerics.ipp (original)
+++ trunk/boost/spirit/core/primitives/impl/numerics.ipp 2007-10-28 10:29:40 EDT (Sun, 28 Oct 2007)
@@ -13,12 +13,6 @@
 #include <cmath>
 #include <limits>
 
-#if defined(BOOST_NO_STDC_NAMESPACE)
-# define BOOST_SPIRIT_IMPL_STD_NS
-#else
-# define BOOST_SPIRIT_IMPL_STD_NS std
-#endif
-
 namespace boost { namespace spirit {
 
     struct sign_parser; // forward declaration only
@@ -383,9 +377,11 @@
 
                     if (RT hit = RealPoliciesT::parse_frac_n(scan))
                     {
+#if !defined(BOOST_NO_STDC_NAMESPACE)
+ using namespace std; // allow for ADL to find pow()
+#endif
                         hit.value(hit.value()
- * BOOST_SPIRIT_IMPL_STD_NS::
- pow(T(10), T(-hit.length())));
+ * pow(T(10), T(-hit.length())));
                         if (neg)
                             n -= hit.value();
                         else
@@ -421,8 +417,10 @@
                     // actual exponent. It is an error if it is not there.
                     if (RT e_n_hit = RealPoliciesT::parse_exp_n(scan))
                     {
- n *= BOOST_SPIRIT_IMPL_STD_NS::
- pow(T(10), T(e_n_hit.value()));
+#if !defined(BOOST_NO_STDC_NAMESPACE)
+ using namespace std; // allow for ADL to find pow()
+#endif
+ n *= pow(T(10), T(e_n_hit.value()));
                         count += e_n_hit.length() + e_hit.length();
                     }
                     else
@@ -453,4 +451,3 @@
 }} // namespace boost::spirit
 
 #endif
-#undef BOOST_SPIRIT_IMPL_STD_NS


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