From 9b8d62d560db70e8b8ee488440027aa744323c86 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sat, 11 Jan 2003 23:19:53 +0000 Subject: [PATCH] borland workarounds [SVN r848] --- include/boost/iterator/iterator_adaptors.hpp | 42 ++++++++++++++----- include/boost/iterator/new_iterator_tests.hpp | 4 +- test/indirect_iterator_test.cpp | 27 ++++++++---- 3 files changed, 54 insertions(+), 19 deletions(-) diff --git a/include/boost/iterator/iterator_adaptors.hpp b/include/boost/iterator/iterator_adaptors.hpp index 6e6bb91..e549a05 100644 --- a/include/boost/iterator/iterator_adaptors.hpp +++ b/include/boost/iterator/iterator_adaptors.hpp @@ -21,6 +21,10 @@ || BOOST_WORKAROUND(__GNUC__, <= 2 && __GNUC_MINOR__ <= 95) \ || BOOST_WORKAROUND(__MWERKS__, <= 0x3000) # define BOOST_NO_SFINAE // "Substitution Failure Is Not An Error not implemented" +#endif + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +# define BOOST_NO_ENABLE_IF_CONSTRUCTORS // Can't parse the syntax needed for enable_if in constructors #endif #if BOOST_WORKAROUND(BOOST_MSVC, <=1200) @@ -35,8 +39,9 @@ # define BOOST_NO_IS_CONVERTIBLE // "is_convertible doesn't work" #endif -#if BOOST_WORKAROUND(__GNUC__, == 2 && __GNUC_MINOR__ == 95) \ - || BOOST_WORKAROUND(__MWERKS__, <= 0x2407) +#if BOOST_WORKAROUND(__GNUC__, == 2 && __GNUC_MINOR__ == 95) \ + || BOOST_WORKAROUND(__MWERKS__, <= 0x2407) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) # define BOOST_NO_MPL_AUX_HAS_XXX // "MPL's has_xxx facility doesn't work" #endif @@ -126,7 +131,9 @@ namespace boost { class Return> struct enable_if_interoperable # if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_IS_CONVERTIBLE) - : enabled< is_interoperable::value >::template base + : detail::enabled< + ::boost::detail::is_interoperable::value + >::template base # else : mpl::identity # endif @@ -188,7 +195,9 @@ namespace boost { typename To> struct enable_if_convertible #if !defined(BOOST_NO_IS_CONVERTIBLE) && !defined(BOOST_NO_SFINAE) - : detail::enabled< is_convertible::value >::template base + : detail::enabled< + ::boost::is_convertible::value + >::template base #else : mpl::identity #endif @@ -657,8 +666,12 @@ namespace boost { : super_t(x) {} template - reverse_iterator(reverse_iterator const& r, - typename enable_if_convertible::type* = 0) + reverse_iterator( + reverse_iterator const& r +# ifndef BOOST_NO_ENABLE_IF_CONSTRUCTORS + , typename enable_if_convertible::type* = 0 +# endif + ) : super_t(r.base()) {} private: @@ -708,8 +721,12 @@ namespace boost { : super_t(x), m_f(f) { } template - transform_iterator(transform_iterator const& t, - typename enable_if_convertible::type* = 0) + transform_iterator( + transform_iterator const& t +# ifndef BOOST_NO_ENABLE_IF_CONSTRUCTORS + , typename enable_if_convertible::type* = 0 +# endif + ) : super_t(t.base()), m_f(t.functor()) {} AdaptableUnaryFunction functor() const { return m_f; } @@ -826,8 +843,13 @@ namespace boost { template - indirect_iterator(indirect_iterator const& y, - typename enable_if_convertible::type* = 0) + indirect_iterator( + indirect_iterator const& y +# ifndef BOOST_NO_ENABLE_IF_CONSTRUCTORS + , typename enable_if_convertible::type* = 0 +# endif + ) + : super_t(y.base()) {} private: diff --git a/include/boost/iterator/new_iterator_tests.hpp b/include/boost/iterator/new_iterator_tests.hpp index bbf3473..e0590c1 100644 --- a/include/boost/iterator/new_iterator_tests.hpp +++ b/include/boost/iterator/new_iterator_tests.hpp @@ -45,8 +45,8 @@ void readable_iterator_test(const Iterator i1, T v) T v2 = r2; assert(v1 == v); assert(v2 == v); - typedef typename return_category::type result_category; - is_readable(result_category()); + typename return_category::type result_category; + is_readable(result_category); } template diff --git a/test/indirect_iterator_test.cpp b/test/indirect_iterator_test.cpp index 0e7f224..404364e 100644 --- a/test/indirect_iterator_test.cpp +++ b/test/indirect_iterator_test.cpp @@ -28,9 +28,9 @@ #include #include -#if defined(BOOST_MSVC_STD_ITERATOR) \ - || BOOST_WORKAROUND(_CPPLIB_VER, <= 310) \ - || BOOST_WORKAROUND(__GNUC__, <= 2 && !defined(__SGI_STL_PORT)) +#if defined(BOOST_MSVC_STD_ITERATOR) \ + || BOOST_WORKAROUND(_CPPLIB_VER, <= 310) \ + || BOOST_WORKAROUND(__GNUC__, <= 2 && !__SGI_STL_PORT) // std container random-access iterators don't support mutable/const // interoperability (but may support const/mutable interop). @@ -108,7 +108,6 @@ namespace boost { namespace detail void more_indirect_iterator_tests() { -// For some reason all heck breaks loose in the compiler under these conditions. storage store(1000); std::generate(store.begin(), store.end(), rand); @@ -154,7 +153,10 @@ void more_indirect_iterator_tests() // Borland C++ is getting very confused about the typedefs here typedef boost::indirect_iterator indirect_set_iterator; - typedef boost::indirect_iterator const_indirect_set_iterator; + typedef boost::indirect_iterator< + iterator_set::iterator + , indirect_const_iterator_traits + > const_indirect_set_iterator; indirect_set_iterator sb(iter_set.begin()); indirect_set_iterator se(iter_set.end()); @@ -189,8 +191,19 @@ main() // Concept checks { - typedef boost::indirect_iterator iter_t; - typedef boost::indirect_iterator c_iter_t; + typedef boost::indirect_iterator iter_t; + + BOOST_STATIC_ASSERT( + boost::detail::has_element_type< + boost::shared_ptr + // std::iterator_traits::value_type + >::value + ); + + typedef boost::indirect_iterator< + shared_t::iterator + , indirect_const_iterator_traits + > c_iter_t; # ifndef NO_MUTABLE_CONST_RA_ITERATOR_INTEROPERABILITY boost::function_requires< boost_concepts::InteroperableConcept >();