borland workarounds

[SVN r848]
This commit is contained in:
Dave Abrahams
2003-01-11 23:19:53 +00:00
parent 09542a1e9f
commit 9b8d62d560
3 changed files with 54 additions and 19 deletions

View File

@@ -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<Facade1, Facade2>::value >::template base<Return>
: detail::enabled<
::boost::detail::is_interoperable<Facade1, Facade2>::value
>::template base<Return>
# else
: mpl::identity<Return>
# 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<From, To>::value >::template base<detail::enable_type>
: detail::enabled<
::boost::is_convertible<From, To>::value
>::template base<detail::enable_type>
#else
: mpl::identity<detail::enable_type>
#endif
@@ -657,8 +666,12 @@ namespace boost {
: super_t(x) {}
template<class OtherIterator>
reverse_iterator(reverse_iterator<OtherIterator> const& r,
typename enable_if_convertible<OtherIterator, Iterator>::type* = 0)
reverse_iterator(
reverse_iterator<OtherIterator> const& r
# ifndef BOOST_NO_ENABLE_IF_CONSTRUCTORS
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0
# endif
)
: super_t(r.base()) {}
private:
@@ -708,8 +721,12 @@ namespace boost {
: super_t(x), m_f(f) { }
template<class OtherIterator>
transform_iterator(transform_iterator<AdaptableUnaryFunction, OtherIterator> const& t,
typename enable_if_convertible<OtherIterator, Iterator>::type* = 0)
transform_iterator(
transform_iterator<AdaptableUnaryFunction, OtherIterator> const& t
# ifndef BOOST_NO_ENABLE_IF_CONSTRUCTORS
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0
# endif
)
: super_t(t.base()), m_f(t.functor()) {}
AdaptableUnaryFunction functor() const { return m_f; }
@@ -826,8 +843,13 @@ namespace boost {
template <class OtherIterator,
class OtherTraits>
indirect_iterator(indirect_iterator<OtherIterator, OtherTraits> const& y,
typename enable_if_convertible<OtherIterator, Iterator>::type* = 0)
indirect_iterator(
indirect_iterator<OtherIterator, OtherTraits> const& y
# ifndef BOOST_NO_ENABLE_IF_CONSTRUCTORS
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0
# endif
)
: super_t(y.base()) {}
private:

View File

@@ -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<Iterator>::type result_category;
is_readable(result_category());
typename return_category<Iterator>::type result_category;
is_readable(result_category);
}
template <class Iterator, class T>

View File

@@ -28,9 +28,9 @@
#include <stdlib.h>
#include <set>
#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<iterator_set::iterator> indirect_set_iterator;
typedef boost::indirect_iterator<iterator_set::const_iterator> const_indirect_set_iterator;
typedef boost::indirect_iterator<
iterator_set::iterator
, indirect_const_iterator_traits<iterator_set::iterator>
> 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<shared_t::iterator> iter_t;
typedef boost::indirect_iterator<shared_t::const_iterator> c_iter_t;
typedef boost::indirect_iterator<shared_t::iterator> iter_t;
BOOST_STATIC_ASSERT(
boost::detail::has_element_type<
boost::shared_ptr<dummyT>
// std::iterator_traits<shared_t::iterator>::value_type
>::value
);
typedef boost::indirect_iterator<
shared_t::iterator
, indirect_const_iterator_traits<shared_t::iterator>
> c_iter_t;
# ifndef NO_MUTABLE_CONST_RA_ITERATOR_INTEROPERABILITY
boost::function_requires< boost_concepts::InteroperableConcept<iter_t, c_iter_t> >();