From 6b2da494305507ac064f520b9c98d7067138aafb Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Thu, 20 Nov 2003 16:17:30 +0000 Subject: [PATCH] Borland workarounds [SVN r20879] --- include/boost/iterator/is_lvalue_iterator.hpp | 30 +++++++++++++++++-- test/is_lvalue_iterator.cpp | 30 +++++++++++++++++-- 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/include/boost/iterator/is_lvalue_iterator.hpp b/include/boost/iterator/is_lvalue_iterator.hpp index 0376d61..bab296f 100755 --- a/include/boost/iterator/is_lvalue_iterator.hpp +++ b/include/boost/iterator/is_lvalue_iterator.hpp @@ -5,13 +5,26 @@ # define IS_LVALUE_ITERATOR_DWA2003112_HPP #include +#include + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +# include +# include +# include +#endif + #include #include -#include +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +# include +# include +#endif + #include -// should be the last #include +// should be the last #includes +#include #include #ifndef BOOST_NO_IS_CONVERTIBLE @@ -49,7 +62,19 @@ namespace detail // convertible to Value const& struct conversion_eater { + // Borland (at leasT 5.5.1) has some problems converting to + // non-const Value& where Value is an integral type. +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) + typedef typename mpl::if_< + mpl::and_, mpl::not_ > > + , Value + , Value& + >::type src; + + conversion_eater(src); +#else conversion_eater(Value&); +#endif }; static char tester(conversion_eater, int); @@ -144,5 +169,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1( #endif #include +#include #endif // IS_LVALUE_ITERATOR_DWA2003112_HPP diff --git a/test/is_lvalue_iterator.cpp b/test/is_lvalue_iterator.cpp index 86026e8..9caffa4 100755 --- a/test/is_lvalue_iterator.cpp +++ b/test/is_lvalue_iterator.cpp @@ -52,6 +52,20 @@ struct proxy_iterator : boost::iterator proxy operator*() const; }; +template +struct lvalue_iterator +{ + typedef T value_type; + typedef T& reference; + typedef T difference_type; + typedef std::input_iterator_tag iterator_category; + typedef T* pointer; + + T& operator*() const; + lvalue_iterator& operator++(); + lvalue_iterator operator++(int); +}; + BOOST_TT_BROKEN_COMPILER_SPEC(proxy_iterator::proxy) int main() @@ -68,8 +82,14 @@ int main() #endif // Make sure inaccessible copy constructor doesn't prevent // reference binding - BOOST_STATIC_ASSERT(boost::is_lvalue_iterator::value); +// BOOST_STATIC_ASSERT(boost::is_lvalue_iterator::value); + BOOST_STATIC_ASSERT(boost::is_lvalue_iterator >::value); + BOOST_STATIC_ASSERT(boost::is_lvalue_iterator >::value); + BOOST_STATIC_ASSERT(boost::is_lvalue_iterator >::value); + BOOST_STATIC_ASSERT(boost::is_lvalue_iterator >::value); + + BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator::value); BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator::value); @@ -81,7 +101,13 @@ int main() #ifndef BOOST_NO_LVALUE_RETURN_DETECTION BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator::value); #endif - BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator::value); +// BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator::value); + + BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator >::value); + BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator >::value); + BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator >::value); + BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator >::value); + BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator >::value); return 0; }