Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85399 - in trunk/boost/spirit/home: qi/numeric/detail support support/char_set
From: joel_at_[hidden]
Date: 2013-08-20 01:11:14


Author: djowel
Date: 2013-08-20 01:11:14 EDT (Tue, 20 Aug 2013)
New Revision: 85399
URL: http://svn.boost.org/trac/boost/changeset/85399

Log:
Fixes ticket #9007

Text files modified:
   trunk/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp | 3 ++-
   trunk/boost/spirit/home/support/char_set/range_run_impl.hpp | 4 ----
   trunk/boost/spirit/home/support/numeric_traits.hpp | 13 +++++++++++++
   3 files changed, 15 insertions(+), 5 deletions(-)

Modified: trunk/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp Mon Aug 19 15:55:19 2013 (r85398)
+++ trunk/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp 2013-08-20 01:11:14 EDT (Tue, 20 Aug 2013) (r85399)
@@ -19,6 +19,7 @@
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/spirit/home/qi/detail/attributes.hpp>
 #include <boost/spirit/home/support/char_encoding/ascii.hpp>
+#include <boost/spirit/home/support/numeric_traits.hpp>
 #include <boost/preprocessor/repetition/repeat.hpp>
 #include <boost/preprocessor/iteration/local.hpp>
 #include <boost/preprocessor/comparison/less.hpp>
@@ -227,7 +228,7 @@
                     ( (MaxDigits < 0)
                     || (MaxDigits > digits_traits<T, Radix>::value)
                     )
- && std::numeric_limits<T>::is_modulo
+ && traits::is_integer_wrapping<T>::value
>()
             );
         }

Modified: trunk/boost/spirit/home/support/char_set/range_run_impl.hpp
==============================================================================
--- trunk/boost/spirit/home/support/char_set/range_run_impl.hpp Mon Aug 19 15:55:19 2013 (r85398)
+++ trunk/boost/spirit/home/support/char_set/range_run_impl.hpp 2013-08-20 01:11:14 EDT (Tue, 20 Aug 2013) (r85399)
@@ -13,7 +13,6 @@
 
 #include <boost/spirit/home/support/char_set/range_functions.hpp>
 #include <boost/assert.hpp>
-#include <boost/integer_traits.hpp>
 #include <algorithm>
 
 namespace boost { namespace spirit { namespace support { namespace detail
@@ -25,9 +24,6 @@
         // if *iter intersects with, or is adjacent to, 'range'...
         if (can_merge(*iter, range))
         {
- typedef typename Range::value_type value_type;
- typedef integer_traits<value_type> integer_traits;
-
             // merge range and *iter
             merge(*iter, range);
 

Modified: trunk/boost/spirit/home/support/numeric_traits.hpp
==============================================================================
--- trunk/boost/spirit/home/support/numeric_traits.hpp Mon Aug 19 15:55:19 2013 (r85398)
+++ trunk/boost/spirit/home/support/numeric_traits.hpp 2013-08-20 01:11:14 EDT (Tue, 20 Aug 2013) (r85399)
@@ -12,6 +12,8 @@
 
 #include <boost/config.hpp>
 #include <boost/mpl/bool.hpp>
+#include <boost/integer_traits.hpp>
+#include <boost/utility/enable_if.hpp>
 
 namespace boost { namespace spirit { namespace traits
 {
@@ -113,6 +115,17 @@
 
     template <typename T, typename Enable = void>
     struct is_infinite;
+
+ template <typename T, typename Enable = void>
+ struct is_integer_wrapping : mpl::false_ {};
+
+ template <typename T>
+ struct is_integer_wrapping_default
+ : mpl::bool_<(T(integer_traits<T>::const_max + 1) == integer_traits<T>::const_min)> {};
+
+ template <typename T>
+ struct is_integer_wrapping<T, typename enable_if_c<integer_traits<T>::is_integral>::type>
+ : is_integer_wrapping_default<T> {};
 }}}
 
 #endif


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