diff --git a/include/boost/integer.hpp b/include/boost/integer.hpp index b39e300..559d2f1 100644 --- a/include/boost/integer.hpp +++ b/include/boost/integer.hpp @@ -17,8 +17,8 @@ #include // self include -#include // for boost::integer_traits -#include // for std::numeric_limits +#include // for boost::::boost::integer_traits +#include // for ::std::numeric_limits #include // for boost::int64_t and BOOST_NO_INTEGRAL_INT64_T namespace boost @@ -31,6 +31,8 @@ namespace boost template< typename LeastInt > struct int_fast_t { typedef LeastInt fast; }; // imps may specialize + namespace detail{ + // convert category to type template< int Category > struct int_least_helper {}; // default is empty @@ -52,23 +54,25 @@ namespace boost template<> struct int_least_helper<9> { typedef unsigned short least; }; template<> struct int_least_helper<10> { typedef unsigned char least; }; + } // namespace detail + // integer templates specifying number of bits ---------------------------// // signed template< int Bits > // bits (including sign) required struct int_t { - typedef typename int_least_helper + typedef typename detail::int_least_helper < #ifdef BOOST_HAS_LONG_LONG (Bits-1 <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + #else 1 + #endif - (Bits-1 <= std::numeric_limits::digits) + - (Bits-1 <= std::numeric_limits::digits) + - (Bits-1 <= std::numeric_limits::digits) + - (Bits-1 <= std::numeric_limits::digits) + (Bits-1 <= ::std::numeric_limits::digits) + + (Bits-1 <= ::std::numeric_limits::digits) + + (Bits-1 <= ::std::numeric_limits::digits) + + (Bits-1 <= ::std::numeric_limits::digits) >::least least; typedef typename int_fast_t::fast fast; }; @@ -77,7 +81,7 @@ namespace boost template< int Bits > // bits required struct uint_t { - typedef typename int_least_helper + typedef typename detail::int_least_helper < 5 + #ifdef BOOST_HAS_LONG_LONG @@ -85,10 +89,10 @@ namespace boost #else 1 + #endif - (Bits <= std::numeric_limits::digits) + - (Bits <= std::numeric_limits::digits) + - (Bits <= std::numeric_limits::digits) + - (Bits <= std::numeric_limits::digits) + (Bits <= ::std::numeric_limits::digits) + + (Bits <= ::std::numeric_limits::digits) + + (Bits <= ::std::numeric_limits::digits) + + (Bits <= ::std::numeric_limits::digits) >::least least; typedef typename int_fast_t::fast fast; // int_fast_t<> works correctly for unsigned too, in spite of the name. @@ -104,17 +108,17 @@ namespace boost #endif struct int_max_value_t { - typedef typename int_least_helper + typedef typename detail::int_least_helper < #ifdef BOOST_HAS_LONG_LONG - (MaxValue <= integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max) + #else 1 + #endif - (MaxValue <= integer_traits::const_max) + - (MaxValue <= integer_traits::const_max) + - (MaxValue <= integer_traits::const_max) + - (MaxValue <= integer_traits::const_max) + (MaxValue <= ::boost::integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max) >::least least; typedef typename int_fast_t::fast fast; }; @@ -126,17 +130,17 @@ namespace boost #endif struct int_min_value_t { - typedef typename int_least_helper + typedef typename detail::int_least_helper < #ifdef BOOST_HAS_LONG_LONG - (MinValue >= integer_traits::const_min) + + (MinValue >= ::boost::integer_traits::const_min) + #else 1 + #endif - (MinValue >= integer_traits::const_min) + - (MinValue >= integer_traits::const_min) + - (MinValue >= integer_traits::const_min) + - (MinValue >= integer_traits::const_min) + (MinValue >= ::boost::integer_traits::const_min) + + (MinValue >= ::boost::integer_traits::const_min) + + (MinValue >= ::boost::integer_traits::const_min) + + (MinValue >= ::boost::integer_traits::const_min) >::least least; typedef typename int_fast_t::fast fast; }; @@ -149,18 +153,18 @@ namespace boost #endif struct uint_value_t { - typedef typename int_least_helper + typedef typename detail::int_least_helper < 5 + #ifdef BOOST_HAS_LONG_LONG - (MaxValue <= integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max) + #else 1 + #endif - (MaxValue <= integer_traits::const_max) + - (MaxValue <= integer_traits::const_max) + - (MaxValue <= integer_traits::const_max) + - (MaxValue <= integer_traits::const_max) + (MaxValue <= ::boost::integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max) >::least least; typedef typename int_fast_t::fast fast; };