diff --git a/include/boost/detail/numeric_traits.hpp b/include/boost/detail/numeric_traits.hpp index c404aed..16cfa4d 100644 --- a/include/boost/detail/numeric_traits.hpp +++ b/include/boost/detail/numeric_traits.hpp @@ -49,6 +49,8 @@ // See http://www.boost.org for most recent version including documentation. // Revision History +// 10 Feb 2001 - Rolled in supposed Borland fixes from John Maddock, but +// not seeing any improvement yet (David Abrahams) // 06 Feb 2001 - Factored if_true out into boost/detail/select_type.hpp // (David Abrahams) // 23 Jan 2001 - Fixed logic of difference_type selection, which was @@ -114,13 +116,42 @@ namespace boost { namespace detail { // here's the "usable" template template struct digit_traits { + typedef digit_traits_select< + ::std::numeric_limits::is_specialized> selector; + typedef typename selector::template traits traits; enum { - digits = digit_traits_select<( - std::numeric_limits::is_specialized - )>::template traits::digits + digits = traits::digits }; }; -#endif +#endif + +#ifdef __BORLANDC__ // // This code from John Maddock, but doesn't seem to make any difference +template +struct select_diff +{ + typedef std::ptrdiff_t difference_type; +}; +template +struct select_diff +{ + typedef T difference_type; +}; +template +struct select_diff +{ + typedef intmax_t difference_type; +}; +template +struct select_diff +{ + typedef std::ptrdiff_t difference_type; +}; +template +struct select_diff +{ + typedef intmax_t difference_type; +}; +#endif // Template class integer_traits -- traits of various integer types // This should probably be rolled into boost::integer_traits one day, but I @@ -159,9 +190,17 @@ namespace boost { namespace detail { // else intmax_t >::type>::type>::type difference_type; -# else +# elif defined(__BORLANDC__) // This code from John Maddock, but doesn't seem to make any difference BOOST_STATIC_ASSERT(boost::is_integral::value); - + typedef select_diff::value), + (sizeof(Integer) >= sizeof(intmax_t)), + (sizeof(Integer) < sizeof(std::ptrdiff_t))> t; + typedef typename t::difference_type difference_type; + +#else + BOOST_STATIC_ASSERT(boost::is_integral::value); + typedef typename if_true<(sizeof(Integer) >= sizeof(intmax_t))>::template then<