From b2701f9f78109509feb6fc925fbd844c6284a244 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sun, 11 Feb 2001 12:50:06 +0000 Subject: [PATCH] Borland compiler fixes [SVN r9110] --- include/boost/counting_iterator.hpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/include/boost/counting_iterator.hpp b/include/boost/counting_iterator.hpp index 86caadc..1b806f1 100644 --- a/include/boost/counting_iterator.hpp +++ b/include/boost/counting_iterator.hpp @@ -130,28 +130,36 @@ namespace detail { // Try to detect numeric types at compile time in ways compatible with the // limitations of the compiler and library. +#ifndef __BORLANDC__ template struct is_numeric { // For a while, this wasn't true, but we rely on it below. This is a regression assert. BOOST_STATIC_ASSERT(::boost::is_integral::value); - enum { value = + enum { value = #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS std::numeric_limits::is_specialized -#elif defined(__BORLANDC__) - ::boost::is_arithmetic::value #else boost::is_convertible::value && boost::is_convertible::value #endif }; }; - +#else + // Borland seems to have a strange problem with is_numeric, just delegate + // to is_arithmetic instead: + template + struct is_numeric { + // For a while, this wasn't true, but we rely on it below. This is a regression assert. + BOOST_STATIC_ASSERT(::boost::is_integral::value); + static const bool value = ::boost::is_arithmetic::value; + }; +#endif // Compute the distance over arbitrary numeric and/or iterator types template Distance any_distance(Incrementable start, Incrementable finish, Distance* = 0) { return distance_policy_select<( - is_numeric::value)>::template + ::boost::detail::is_numeric::value)>::template policy::distance(start, finish); } @@ -160,10 +168,11 @@ namespace detail { template struct counting_iterator_traits { private: - enum {numeric = detail::is_numeric::value }; - typedef typename detail::counting_iterator_traits_select<( - numeric - )>::template traits traits; + BOOST_STATIC_ASSERT(::boost::detail::is_numeric::value == ::boost::is_arithmetic::value); + typedef ::boost::detail::counting_iterator_traits_select<( + ::boost::detail::is_numeric::value + )> binder; + typedef typename binder::template traits traits; public: typedef Incrementable value_type; typedef const Incrementable& reference;