Revert changes that were merged to master.

Reverted: 2e099caceb9..21102938e8ccb

I'm going to reapply some of them soon, but it's easier to revert them
all first, as there are conflicts. Also the number of changes that were
inserted since then, mean that there would be a huge gap between related
changes.
This commit is contained in:
Daniel James
2014-06-06 00:56:20 +01:00
parent c142956936
commit 8e5b8025d8
23 changed files with 417 additions and 68 deletions

View File

@ -106,7 +106,7 @@ The ``iterator_category`` member of ``iterator_facade`` is
.. parsed-literal:: .. parsed-literal::
*iterator-category*\ (CategoryOrTraversal, reference, value_type) *iterator-category*\ (CategoryOrTraversal, value_type, reference)
where *iterator-category* is defined as follows: where *iterator-category* is defined as follows:

View File

@ -26,7 +26,7 @@
// libs/iterator/test/constant_iterator_arrow.cpp fails to compile // libs/iterator/test/constant_iterator_arrow.cpp fails to compile
// because the operator-> return is improperly deduced as a non-const // because the operator-> return is improperly deduced as a non-const
// pointer. // pointer.
#if 1 \ #if 1 || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x531)) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x531))
// Recall that in general, compilers without partial specialization // Recall that in general, compilers without partial specialization
@ -46,7 +46,8 @@
#endif #endif
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x5A0)) \ #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x5A0)) \
|| (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \ || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \
|| BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) \ || BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) \
|| BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
@ -87,7 +88,8 @@
# define BOOST_NO_IS_CONVERTIBLE // "is_convertible doesn't work for simple types" # define BOOST_NO_IS_CONVERTIBLE // "is_convertible doesn't work for simple types"
#endif #endif
#if BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, < 4) && !defined(__EDG_VERSION__) \ #if BOOST_WORKAROUND(__GNUC__, == 2) \
|| BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, < 4) && !defined(__EDG_VERSION__) \
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
# define BOOST_NO_IS_CONVERTIBLE_TEMPLATE // The following program fails to compile: # define BOOST_NO_IS_CONVERTIBLE_TEMPLATE // The following program fails to compile:
@ -114,9 +116,16 @@
# define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY # define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
#endif #endif
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) # if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
# define BOOST_ARG_DEPENDENT_TYPENAME typename
# else
# define BOOST_ARG_DEPENDENT_TYPENAME
# endif
// GCC-2.95 (obsolete) eagerly instantiates templated constructors and conversion # if BOOST_WORKAROUND(__GNUC__, == 2) && BOOST_WORKAROUND(__GNUC_MINOR__, BOOST_TESTED_AT(95)) \
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
// GCC-2.95 eagerly instantiates templated constructors and conversion
// operators in convertibility checks, causing premature errors. // operators in convertibility checks, causing premature errors.
// //
// Borland's problems are harder to diagnose due to lack of an // Borland's problems are harder to diagnose due to lack of an

View File

@ -14,6 +14,7 @@
#undef BOOST_NO_IS_CONVERTIBLE #undef BOOST_NO_IS_CONVERTIBLE
#undef BOOST_NO_IS_CONVERTIBLE_TEMPLATE #undef BOOST_NO_IS_CONVERTIBLE_TEMPLATE
#undef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY #undef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
#undef BOOST_ARG_DEPENDENT_TYPENAME
#undef BOOST_NO_LVALUE_RETURN_DETECTION #undef BOOST_NO_LVALUE_RETURN_DETECTION
#undef BOOST_NO_ONE_WAY_ITERATOR_INTEROP #undef BOOST_NO_ONE_WAY_ITERATOR_INTEROP

View File

@ -72,6 +72,9 @@ namespace boost
: mpl::identity<Return> : mpl::identity<Return>
# endif # endif
{ {
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
typedef Return type;
# endif
}; };
} // namespace iterators } // namespace iterators

View File

@ -73,8 +73,15 @@ struct iterator_writability_disabled
// Convert an iterator_facade's traversal category, Value parameter, // Convert an iterator_facade's traversal category, Value parameter,
// and ::reference type to an appropriate old-style category. // and ::reference type to an appropriate old-style category.
// //
// Due to changeset 21683, this now never results in a category convertible // If writability has been disabled per the above metafunction, the
// to output_iterator_tag. // result will not be convertible to output_iterator_tag.
//
// Otherwise, if Traversal == single_pass_traversal_tag, the following
// conditions will result in a tag that is convertible both to
// input_iterator_tag and output_iterator_tag:
//
// 1. Reference is a reference to non-const
// 2. Reference is not a reference and is convertible to Value
// //
template <class Traversal, class ValueParam, class Reference> template <class Traversal, class ValueParam, class Reference>
struct iterator_facade_default_category struct iterator_facade_default_category
@ -131,6 +138,7 @@ template <class Category, class Traversal>
struct iterator_category_with_traversal struct iterator_category_with_traversal
: Category, Traversal : Category, Traversal
{ {
# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
// Make sure this isn't used to build any categories where // Make sure this isn't used to build any categories where
// convertibility to Traversal is redundant. Should just use the // convertibility to Traversal is redundant. Should just use the
// Category element in that case. // Category element in that case.
@ -146,6 +154,7 @@ struct iterator_category_with_traversal
# if !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) # if !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
BOOST_MPL_ASSERT((is_iterator_traversal<Traversal>)); BOOST_MPL_ASSERT((is_iterator_traversal<Traversal>));
# endif # endif
# endif
}; };
// Computes an iterator_category tag whose traversal is Traversal and // Computes an iterator_category tag whose traversal is Traversal and
@ -153,7 +162,9 @@ struct iterator_category_with_traversal
template <class Traversal, class ValueParam, class Reference> template <class Traversal, class ValueParam, class Reference>
struct facade_iterator_category_impl struct facade_iterator_category_impl
{ {
# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
BOOST_MPL_ASSERT_NOT((is_iterator_category<Traversal>)); BOOST_MPL_ASSERT_NOT((is_iterator_category<Traversal>));
# endif
typedef typename iterator_facade_default_category< typedef typename iterator_facade_default_category<
Traversal,ValueParam,Reference Traversal,ValueParam,Reference

26
include/boost/iterator/detail/minimum_category.hpp Normal file → Executable file
View File

@ -21,7 +21,17 @@ namespace boost { namespace detail {
// //
// //
template <bool GreaterEqual, bool LessEqual> template <bool GreaterEqual, bool LessEqual>
struct minimum_category_impl; struct minimum_category_impl
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
{
template <class T1, class T2> struct apply
{
typedef T2 type;
};
typedef void type;
}
# endif
;
template <class T1, class T2> template <class T1, class T2>
struct error_not_related_by_convertibility; struct error_not_related_by_convertibility;
@ -67,8 +77,14 @@ template <class T1 = mpl::_1, class T2 = mpl::_2>
struct minimum_category struct minimum_category
{ {
typedef minimum_category_impl< typedef minimum_category_impl<
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround
is_same<T2,int>::value ||
# endif
::boost::is_convertible<T1,T2>::value ::boost::is_convertible<T1,T2>::value
, ::boost::is_convertible<T2,T1>::value , ::boost::is_convertible<T2,T1>::value
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround
|| is_same<T1,int>::value
# endif
> outer; > outer;
typedef typename outer::template apply<T1,T2> inner; typedef typename outer::template apply<T1,T2> inner;
@ -87,6 +103,14 @@ struct minimum_category<mpl::_1,mpl::_2>
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,minimum_category,(mpl::_1,mpl::_2)) BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,minimum_category,(mpl::_1,mpl::_2))
}; };
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround
template <>
struct minimum_category<int,int>
{
typedef int type;
};
# endif
}} // namespace boost::detail }} // namespace boost::detail
#endif // MINIMUM_CATEGORY_DWA20031119_HPP #endif // MINIMUM_CATEGORY_DWA20031119_HPP

View File

@ -121,7 +121,11 @@ namespace boost
is_class<Predicate> is_class<Predicate>
, Iterator , Iterator
>::type x >::type x
, Iterator end = Iterator()) , Iterator end = Iterator()
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
, Predicate* = 0
#endif
)
{ {
return filter_iterator<Predicate,Iterator>(x,end); return filter_iterator<Predicate,Iterator>(x,end);
} }

View File

@ -38,12 +38,14 @@ namespace boost
// explicitly in order to specify that the default should be used. // explicitly in order to specify that the default should be used.
struct use_default; struct use_default;
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
// the incompleteness of use_default causes massive problems for // the incompleteness of use_default causes massive problems for
// is_convertible (naturally). This workaround is fortunately not // is_convertible (naturally). This workaround is fortunately not
// needed for vc6/vc7. // needed for vc6/vc7.
template<class To> template<class To>
struct is_convertible<use_default,To> struct is_convertible<use_default,To>
: mpl::false_ {}; : mpl::false_ {};
# endif
namespace detail namespace detail
{ {
@ -97,7 +99,22 @@ namespace boost
// false positives for user/library defined iterator types. See comments // false positives for user/library defined iterator types. See comments
// on operator implementation for consequences. // on operator implementation for consequences.
// //
# if defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_SFINAE) # if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
template<typename From, typename To>
struct enable_if_convertible
{
typedef typename mpl::if_<
mpl::or_<
is_same<From,To>
, is_convertible<From, To>
>
, boost::detail::enable_type
, int&
>::type type;
};
# elif defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_SFINAE)
template <class From, class To> template <class From, class To>
struct enable_if_convertible struct enable_if_convertible
@ -105,7 +122,7 @@ namespace boost
typedef boost::detail::enable_type type; typedef boost::detail::enable_type type;
}; };
# elif BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292)) # elif BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292)) && BOOST_MSVC > 1300
// For some reason vc7.1 needs us to "cut off" instantiation // For some reason vc7.1 needs us to "cut off" instantiation
// of is_convertible in a few cases. // of is_convertible in a few cases.

View File

@ -20,6 +20,7 @@
#include <boost/concept_archetype.hpp> #include <boost/concept_archetype.hpp>
#include <boost/mpl/aux_/msvc_eti_base.hpp>
#include <boost/mpl/bitand.hpp> #include <boost/mpl/bitand.hpp>
#include <boost/mpl/int.hpp> #include <boost/mpl/int.hpp>
#include <boost/mpl/equal_to.hpp> #include <boost/mpl/equal_to.hpp>
@ -118,7 +119,8 @@ namespace detail
template <class Value, class AccessCategory, class TraversalCategory> template <class Value, class AccessCategory, class TraversalCategory>
struct operator_brackets struct operator_brackets
: mpl::eval_if< : mpl::aux::msvc_eti_base<
typename mpl::eval_if<
is_convertible<TraversalCategory, random_access_traversal_tag> is_convertible<TraversalCategory, random_access_traversal_tag>
, mpl::eval_if< , mpl::eval_if<
iterator_archetypes::has_access< iterator_archetypes::has_access<
@ -137,6 +139,7 @@ namespace detail
> >
, mpl::identity<no_operator_brackets> , mpl::identity<no_operator_brackets>
>::type >::type
>::type
{}; {};
template <class TraversalCategory> template <class TraversalCategory>
@ -151,7 +154,9 @@ namespace detail
template <class Derived, class Value, class TraversalCategory> template <class Derived, class Value, class TraversalCategory>
struct traversal_archetype_ struct traversal_archetype_
: traversal_archetype_impl<TraversalCategory>::template archetype<Derived,Value> : mpl::aux::msvc_eti_base<
typename traversal_archetype_impl<TraversalCategory>::template archetype<Derived,Value>
>::type
{ {
typedef typename typedef typename
traversal_archetype_impl<TraversalCategory>::template archetype<Derived,Value> traversal_archetype_impl<TraversalCategory>::template archetype<Derived,Value>
@ -200,6 +205,12 @@ namespace detail
bool operator==(traversal_archetype_<Derived, Value, single_pass_traversal_tag> const&, bool operator==(traversal_archetype_<Derived, Value, single_pass_traversal_tag> const&,
traversal_archetype_<Derived, Value, single_pass_traversal_tag> const&) { return true; } traversal_archetype_<Derived, Value, single_pass_traversal_tag> const&) { return true; }
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
// doesn't seem to pick up != from equality_comparable
template <class Derived, class Value>
bool operator!=(traversal_archetype_<Derived, Value, single_pass_traversal_tag> const&,
traversal_archetype_<Derived, Value, single_pass_traversal_tag> const&) { return true; }
#endif
template <> template <>
struct traversal_archetype_impl<forward_traversal_tag> struct traversal_archetype_impl<forward_traversal_tag>
{ {
@ -298,9 +309,11 @@ struct iterator_access_archetype_impl
template <class Value, class AccessCategory> template <class Value, class AccessCategory>
struct iterator_access_archetype struct iterator_access_archetype
: iterator_access_archetype_impl< : mpl::aux::msvc_eti_base<
typename iterator_access_archetype_impl<
AccessCategory AccessCategory
>::template archetype<Value> >::template archetype<Value>
>::type
{ {
}; };
@ -330,7 +343,9 @@ struct iterator_access_archetype_impl<
template <class Value> template <class Value>
struct archetype struct archetype
{ {
# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
BOOST_STATIC_ASSERT(!is_const<Value>::value); BOOST_STATIC_ASSERT(!is_const<Value>::value);
# endif
typedef void value_type; typedef void value_type;
typedef void reference; typedef void reference;
typedef void pointer; typedef void pointer;
@ -381,7 +396,9 @@ struct iterator_access_archetype_impl<iterator_archetypes::writable_lvalue_itera
Value, iterator_archetypes::readable_lvalue_iterator_t Value, iterator_archetypes::readable_lvalue_iterator_t
> >
{ {
# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
BOOST_STATIC_ASSERT((!is_const<Value>::value)); BOOST_STATIC_ASSERT((!is_const<Value>::value));
# endif
}; };
}; };

View File

@ -97,6 +97,14 @@ namespace detail
> >
{}; {};
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
template <>
struct old_category_to_traversal<int>
{
typedef int type;
};
# endif
template <class Traversal> template <class Traversal>
struct pure_traversal_tag struct pure_traversal_tag
: mpl::eval_if< : mpl::eval_if<
@ -123,6 +131,14 @@ namespace detail
{ {
}; };
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
template <>
struct pure_traversal_tag<int>
{
typedef int type;
};
# endif
} // namespace detail } // namespace detail

View File

@ -1,7 +1,6 @@
// (C) Copyright David Abrahams 2002. // (C) Copyright David Abrahams 2002.
// (C) Copyright Jeremy Siek 2002. // (C) Copyright Jeremy Siek 2002.
// (C) Copyright Thomas Witt 2002. // (C) Copyright Thomas Witt 2002.
// (C) copyright Jeffrey Lee Hellrung, Jr. 2012.
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -14,7 +13,6 @@
#include <boost/iterator/detail/facade_iterator_category.hpp> #include <boost/iterator/detail/facade_iterator_category.hpp>
#include <boost/iterator/detail/enable_if.hpp> #include <boost/iterator/detail/enable_if.hpp>
#include <boost/iterator/detail/operator_brackets_dispatch.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/utility/addressof.hpp> #include <boost/utility/addressof.hpp>
@ -67,6 +65,18 @@ namespace boost
, class Return , class Return
> >
struct enable_if_interoperable struct enable_if_interoperable
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
{
typedef typename mpl::if_<
mpl::or_<
is_convertible<Facade1, Facade2>
, is_convertible<Facade2, Facade1>
>
, Return
, int[3]
>::type type;
};
#else
: ::boost::iterators::enable_if< : ::boost::iterators::enable_if<
mpl::or_< mpl::or_<
is_convertible<Facade1, Facade2> is_convertible<Facade1, Facade2>
@ -75,6 +85,7 @@ namespace boost
, Return , Return
> >
{}; {};
#endif
// //
// Generates associated types for an iterator_facade with the // Generates associated types for an iterator_facade with the
@ -101,7 +112,10 @@ namespace boost
, add_pointer<value_type> , add_pointer<value_type>
>::type pointer; >::type pointer;
# if BOOST_WORKAROUND(BOOST_RWSTD_VER, BOOST_TESTED_AT(0x20101)) \ # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
&& (BOOST_WORKAROUND(_STLPORT_VERSION, BOOST_TESTED_AT(0x452)) \
|| BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, BOOST_TESTED_AT(310))) \
|| BOOST_WORKAROUND(BOOST_RWSTD_VER, BOOST_TESTED_AT(0x20101)) \
|| BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, <= 310) || BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, <= 310)
// To interoperate with some broken library/compiler // To interoperate with some broken library/compiler
@ -201,6 +215,33 @@ namespace boost
Iterator stored_iterator; Iterator stored_iterator;
}; };
# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class Reference, class Value>
struct is_non_proxy_reference_impl
{
static Reference r;
template <class R>
static typename mpl::if_<
is_convertible<
R const volatile*
, Value const volatile*
>
, char[1]
, char[2]
>::type& helper(R const&);
BOOST_STATIC_CONSTANT(bool, value = sizeof(helper(r)) == 1);
};
template <class Reference, class Value>
struct is_non_proxy_reference
: mpl::bool_<
is_non_proxy_reference_impl<Reference, Value>::value
>
{};
# else
template <class Reference, class Value> template <class Reference, class Value>
struct is_non_proxy_reference struct is_non_proxy_reference
: is_convertible< : is_convertible<
@ -209,6 +250,7 @@ namespace boost
, Value const volatile* , Value const volatile*
> >
{}; {};
# endif
// A metafunction to choose the result type of postfix ++ // A metafunction to choose the result type of postfix ++
// //
@ -254,7 +296,7 @@ namespace boost
// standard's requirements. If *i is not a reference type, we must still // standard's requirements. If *i is not a reference type, we must still
// produce an lvalue to which a pointer can be formed. We do that by // produce an lvalue to which a pointer can be formed. We do that by
// returning a proxy object containing an instance of the reference object. // returning a proxy object containing an instance of the reference object.
template <class Reference> template <class Reference, class Pointer>
struct operator_arrow_dispatch // proxy references struct operator_arrow_dispatch // proxy references
{ {
struct proxy struct proxy
@ -273,16 +315,92 @@ namespace boost
} }
}; };
template <class T> template <class T, class Pointer>
struct operator_arrow_dispatch<T&> // "real" references struct operator_arrow_dispatch<T&, Pointer> // "real" references
{ {
typedef T* result_type; typedef Pointer result_type;
static result_type apply(T& x) static result_type apply(T& x)
{ {
return boost::addressof(x); return boost::addressof(x);
} }
}; };
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
// Deal with ETI
template<>
struct operator_arrow_dispatch<int, int>
{
typedef int result_type;
};
# endif
// A proxy return type for operator[], needed to deal with
// iterators that may invalidate referents upon destruction.
// Consider the temporary iterator in *(a + n)
template <class Iterator>
class operator_brackets_proxy
{
// Iterator is actually an iterator_facade, so we do not have to
// go through iterator_traits to access the traits.
typedef typename Iterator::reference reference;
typedef typename Iterator::value_type value_type;
public:
operator_brackets_proxy(Iterator const& iter)
: m_iter(iter)
{}
operator reference() const
{
return *m_iter;
}
operator_brackets_proxy& operator=(value_type const& val)
{
*m_iter = val;
return *this;
}
private:
Iterator m_iter;
};
// A metafunction that determines whether operator[] must return a
// proxy, or whether it can simply return a copy of the value_type.
template <class ValueType, class Reference>
struct use_operator_brackets_proxy
: mpl::not_<
mpl::and_<
// Really we want an is_copy_constructible trait here,
// but is_POD will have to suffice in the meantime.
boost::is_POD<ValueType>
, iterator_writability_disabled<ValueType,Reference>
>
>
{};
template <class Iterator, class Value, class Reference>
struct operator_brackets_result
{
typedef typename mpl::if_<
use_operator_brackets_proxy<Value,Reference>
, operator_brackets_proxy<Iterator>
, Value
>::type type;
};
template <class Iterator>
operator_brackets_proxy<Iterator> make_operator_brackets_result(Iterator const& iter, mpl::true_)
{
return operator_brackets_proxy<Iterator>(iter);
}
template <class Iterator>
typename Iterator::value_type make_operator_brackets_result(Iterator const& iter, mpl::false_)
{
return *iter;
}
struct choose_difference_type struct choose_difference_type
{ {
template <class I1, class I2> template <class I1, class I2>
@ -290,6 +408,12 @@ namespace boost
: :
# ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP # ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP
iterator_difference<I1> iterator_difference<I1>
# elif BOOST_WORKAROUND(BOOST_MSVC, < 1300)
mpl::if_<
is_convertible<I2,I1>
, typename I1::difference_type
, typename I2::difference_type
>
# else # else
mpl::eval_if< mpl::eval_if<
is_convertible<I2,I1> is_convertible<I2,I1>
@ -492,10 +616,9 @@ namespace boost
> associated_types; > associated_types;
typedef boost::detail::operator_arrow_dispatch< typedef boost::detail::operator_arrow_dispatch<
Reference> operator_arrow_dispatch_; Reference
, typename associated_types::pointer
typedef typename boost::detail::operator_brackets_dispatch< > operator_arrow_dispatch_;
Derived, Value, Reference>::type operator_brackets_dispatch_;
protected: protected:
// For use by derived classes // For use by derived classes
@ -521,10 +644,15 @@ namespace boost
return operator_arrow_dispatch_::apply(*this->derived()); return operator_arrow_dispatch_::apply(*this->derived());
} }
typename operator_brackets_dispatch_::result_type typename boost::detail::operator_brackets_result<Derived,Value,reference>::type
operator[](difference_type n) const operator[](difference_type n) const
{ {
return operator_brackets_dispatch_::apply(this->derived() + n); typedef boost::detail::use_operator_brackets_proxy<Value,Reference> use_proxy;
return boost::detail::make_operator_brackets_result<Derived>(
this->derived() + n
, use_proxy()
);
} }
Derived& operator++() Derived& operator++()
@ -533,6 +661,17 @@ namespace boost
return this->derived(); return this->derived();
} }
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
typename boost::detail::postfix_increment_result<Derived,Value,Reference,CategoryOrTraversal>::type
operator++(int)
{
typename boost::detail::postfix_increment_result<Derived,Value,Reference,CategoryOrTraversal>::type
tmp(this->derived());
++*this;
return tmp;
}
# endif
Derived& operator--() Derived& operator--()
{ {
iterator_core_access::decrement(this->derived()); iterator_core_access::decrement(this->derived());
@ -563,8 +702,21 @@ namespace boost
Derived result(this->derived()); Derived result(this->derived());
return result -= x; return result -= x;
} }
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
// There appears to be a bug which trashes the data of classes
// derived from iterator_facade when they are assigned unless we
// define this assignment operator. This bug is only revealed
// (so far) in STLPort debug mode, but it's clearly a codegen
// problem so we apply the workaround for all MSVC6.
iterator_facade& operator=(iterator_facade const&)
{
return *this;
}
# endif
}; };
# if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
template <class I, class V, class TC, class R, class D> template <class I, class V, class TC, class R, class D>
inline typename boost::detail::postfix_increment_result<I,V,R,TC>::type inline typename boost::detail::postfix_increment_result<I,V,R,TC>::type
operator++( operator++(
@ -579,6 +731,7 @@ namespace boost
return tmp; return tmp;
} }
# endif
// //

View File

@ -10,8 +10,18 @@
namespace boost { namespace boost {
// Obsolete. Remove. // Unfortunately, g++ 2.95.x chokes when we define a class template
#define BOOST_ITERATOR_CATEGORY iterator_category // iterator_category which has the same name as its
// std::iterator_category() function, probably due in part to the
// "std:: is visible globally" hack it uses. Use
// BOOST_ITERATOR_CATEGORY to write code that's portable to older
// GCCs.
# if BOOST_WORKAROUND(__GNUC__, <= 2)
# define BOOST_ITERATOR_CATEGORY iterator_category_
# else
# define BOOST_ITERATOR_CATEGORY iterator_category
# endif
template <class Iterator> template <class Iterator>
@ -40,11 +50,43 @@ struct iterator_difference
}; };
template <class Iterator> template <class Iterator>
struct iterator_category struct BOOST_ITERATOR_CATEGORY
{ {
typedef typename boost::detail::iterator_traits<Iterator>::iterator_category type; typedef typename boost::detail::iterator_traits<Iterator>::iterator_category type;
}; };
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
template <>
struct iterator_value<int>
{
typedef void type;
};
template <>
struct iterator_reference<int>
{
typedef void type;
};
template <>
struct iterator_pointer<int>
{
typedef void type;
};
template <>
struct iterator_difference<int>
{
typedef void type;
};
template <>
struct BOOST_ITERATOR_CATEGORY<int>
{
typedef void type;
};
# endif
} // namespace boost::iterator } // namespace boost::iterator
#endif // ITERATOR_TRAITS_DWA200347_HPP #endif // ITERATOR_TRAITS_DWA200347_HPP

View File

@ -140,14 +140,31 @@ namespace boost
// function pointer in the iterator be 0, leading to a runtime // function pointer in the iterator be 0, leading to a runtime
// crash. // crash.
template <class UnaryFunc, class Iterator> template <class UnaryFunc, class Iterator>
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
typename mpl::if_<
#else
typename iterators::enable_if< typename iterators::enable_if<
#endif
is_class<UnaryFunc> // We should probably find a cheaper test than is_class<> is_class<UnaryFunc> // We should probably find a cheaper test than is_class<>
, transform_iterator<UnaryFunc, Iterator> , transform_iterator<UnaryFunc, Iterator>
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
, int[3]
#endif
>::type >::type
make_transform_iterator(Iterator it) make_transform_iterator(Iterator it)
{ {
return transform_iterator<UnaryFunc, Iterator>(it, UnaryFunc()); return transform_iterator<UnaryFunc, Iterator>(it, UnaryFunc());
} }
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
template <class Return, class Argument, class Iterator>
transform_iterator< Return (*)(Argument), Iterator, Return>
make_transform_iterator(Iterator it, Return (*fun)(Argument))
{
return transform_iterator<Return (*)(Argument), Iterator, Return>(it, fun);
}
#endif
} // namespace boost } // namespace boost
#include <boost/iterator/detail/config_undef.hpp> #include <boost/iterator/detail/config_undef.hpp>

View File

@ -166,7 +166,14 @@ namespace boost {
> >
struct tuple_meta_accumulate struct tuple_meta_accumulate
: mpl::eval_if< : mpl::eval_if<
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
mpl::or_<
#endif
boost::is_same<Tuple, tuples::null_type> boost::is_same<Tuple, tuples::null_type>
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
, boost::is_same<Tuple,int>
>
#endif
, mpl::identity<StartType> , mpl::identity<StartType>
, tuple_meta_accumulate_impl< , tuple_meta_accumulate_impl<
Tuple Tuple
@ -360,6 +367,14 @@ namespace boost {
>::type type; >::type type;
}; };
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround
template <>
struct minimum_traversal_category_in_iterator_tuple<int>
{
typedef int type;
};
#endif
// We need to call tuple_meta_accumulate with mpl::and_ as the // We need to call tuple_meta_accumulate with mpl::and_ as the
// accumulating functor. To this end, we need to wrap it into // accumulating functor. To this end, we need to wrap it into
// a struct that has exactly two arguments (that is, template // a struct that has exactly two arguments (that is, template

View File

@ -25,6 +25,7 @@
# include <boost/static_assert.hpp> # include <boost/static_assert.hpp>
# include <boost/concept_archetype.hpp> // for detail::dummy_constructor # include <boost/concept_archetype.hpp> // for detail::dummy_constructor
# include <boost/implicit_cast.hpp> # include <boost/implicit_cast.hpp>
# include <boost/type_traits/broken_compiler_spec.hpp>
namespace boost { namespace boost {
@ -40,6 +41,8 @@ struct dummyT {
} }
BOOST_TT_BROKEN_COMPILER_SPEC(boost::dummyT)
namespace boost { namespace boost {
// Tests whether type Iterator satisfies the requirements for a // Tests whether type Iterator satisfies the requirements for a

View File

@ -44,6 +44,5 @@ test-suite iterator
[ run permutation_iterator_test.cpp : : : # <stlport-iostream>on [ run permutation_iterator_test.cpp : : : # <stlport-iostream>on
] ]
[ run function_input_iterator_test.cpp ] [ run function_input_iterator_test.cpp ]
[ run generator_iterator_test.cpp ]
; ;

View File

@ -27,6 +27,8 @@ struct my_ptr {
// typedef boost::no_traversal_tag iterator_category; // typedef boost::no_traversal_tag iterator_category;
}; };
BOOST_TT_BROKEN_COMPILER_SPEC(my_ptr)
BOOST_TT_BROKEN_COMPILER_SPEC(zow)
// Borland 5.6.4 and earlier drop const all over the place, so this // Borland 5.6.4 and earlier drop const all over the place, so this
// test will fail in the lines marked with (**) // test will fail in the lines marked with (**)
@ -80,7 +82,7 @@ int main()
typedef boost::indirect_iterator<char**, int, std::random_access_iterator_tag, long&, short> Iter; typedef boost::indirect_iterator<char**, int, std::random_access_iterator_tag, long&, short> Iter;
STATIC_ASSERT_SAME(Iter::value_type, int); STATIC_ASSERT_SAME(Iter::value_type, int);
STATIC_ASSERT_SAME(Iter::reference, long&); STATIC_ASSERT_SAME(Iter::reference, long&);
STATIC_ASSERT_SAME(Iter::pointer, long*); STATIC_ASSERT_SAME(Iter::pointer, int*);
STATIC_ASSERT_SAME(Iter::difference_type, short); STATIC_ASSERT_SAME(Iter::difference_type, short);
} }
return 0; return 0;

View File

@ -27,6 +27,8 @@
#include <boost/mpl/has_xxx.hpp> #include <boost/mpl/has_xxx.hpp>
#include <boost/type_traits/broken_compiler_spec.hpp>
#include <boost/detail/lightweight_test.hpp> #include <boost/detail/lightweight_test.hpp>
#include <vector> #include <vector>
@ -51,6 +53,7 @@ template <int I> struct see_val;
struct my_iterator_tag : public std::random_access_iterator_tag { }; struct my_iterator_tag : public std::random_access_iterator_tag { };
using boost::dummyT; using boost::dummyT;
BOOST_TT_BROKEN_COMPILER_SPEC(boost::shared_ptr<dummyT>)
typedef std::vector<int> storage; typedef std::vector<int> storage;
typedef std::vector<int*> pointer_ra_container; typedef std::vector<int*> pointer_ra_container;

4
test/is_lvalue_iterator.cpp Normal file → Executable file
View File

@ -7,6 +7,7 @@
#include <iostream> #include <iostream>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/type_traits/broken_compiler_spec.hpp>
#include <boost/iterator/is_lvalue_iterator.hpp> #include <boost/iterator/is_lvalue_iterator.hpp>
#include <boost/iterator.hpp> #include <boost/iterator.hpp>
@ -19,6 +20,7 @@ struct v
~v(); ~v();
}; };
BOOST_TT_BROKEN_COMPILER_SPEC(v)
struct value_iterator : boost::iterator<std::input_iterator_tag,v> struct value_iterator : boost::iterator<std::input_iterator_tag,v>
{ {
@ -81,6 +83,8 @@ struct constant_lvalue_iterator
constant_lvalue_iterator operator++(int); constant_lvalue_iterator operator++(int);
}; };
BOOST_TT_BROKEN_COMPILER_SPEC(proxy_iterator<v>::proxy)
BOOST_TT_BROKEN_COMPILER_SPEC(proxy_iterator<int>::proxy)
int main() int main()
{ {

3
test/is_readable_iterator.cpp Normal file → Executable file
View File

@ -7,6 +7,7 @@
#include <iostream> #include <iostream>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/type_traits/broken_compiler_spec.hpp>
#include <boost/iterator/is_readable_iterator.hpp> #include <boost/iterator/is_readable_iterator.hpp>
#include <boost/iterator.hpp> #include <boost/iterator.hpp>
@ -19,6 +20,7 @@ struct v
~v(); ~v();
}; };
BOOST_TT_BROKEN_COMPILER_SPEC(v)
struct value_iterator : boost::iterator<std::input_iterator_tag,v> struct value_iterator : boost::iterator<std::input_iterator_tag,v>
{ {
@ -69,6 +71,7 @@ struct proxy_iterator2 : boost::iterator<std::output_iterator_tag,v>
proxy operator*() const; proxy operator*() const;
}; };
BOOST_TT_BROKEN_COMPILER_SPEC(proxy_iterator::proxy)
int main() int main()
{ {

View File

@ -19,6 +19,8 @@
#endif #endif
#include <boost/pending/iterator_tests.hpp> #include <boost/pending/iterator_tests.hpp>
# include <boost/type_traits/broken_compiler_spec.hpp>
# include <boost/detail/lightweight_test.hpp> # include <boost/detail/lightweight_test.hpp>
#include <stdlib.h> #include <stdlib.h>

1
test/pointee.cpp Normal file → Executable file
View File

@ -35,6 +35,7 @@ struct X {
template <class T> operator T&() const; template <class T> operator T&() const;
}; };
BOOST_TT_BROKEN_COMPILER_SPEC(X)
int main() int main()
{ {

View File

@ -7,10 +7,13 @@
#include "static_assert_same.hpp" #include "static_assert_same.hpp"
#include <boost/type_traits/broken_compiler_spec.hpp>
#include <boost/iterator/detail/minimum_category.hpp> #include <boost/iterator/detail/minimum_category.hpp>
struct X { int a; }; struct X { int a; };
BOOST_TT_BROKEN_COMPILER_SPEC(X)
struct Xiter : boost::iterator_adaptor<Xiter,X*> struct Xiter : boost::iterator_adaptor<Xiter,X*>
{ {