A little extra qualification to help out MSVC 6

[SVN r20606]
This commit is contained in:
Douglas Gregor 2003-11-02 19:51:23 +00:00
parent e888f18b5a
commit c7bec1cf56

View File

@ -36,7 +36,7 @@ namespace boost
// indicate "use the default", this can also be passed by users // indicate "use the default", this can also be passed by users
// 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 # 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
@ -44,15 +44,15 @@ namespace boost
template<class To> template<class To>
struct is_convertible<use_default,To> struct is_convertible<use_default,To>
: mpl::false_ {}; : mpl::false_ {};
# endif # endif
namespace detail namespace detail
{ {
// //
// enable if for use in operator implementation. // enable if for use in operator implementation.
// //
// enable_if_interoperable falls back to always enabled for compilers // enable_if_interoperable falls back to always enabled for compilers
// that don't support enable_if or is_convertible. // that don't support enable_if or is_convertible.
// //
template < template <
class Facade1 class Facade1
@ -68,11 +68,11 @@ namespace boost
> >
, Return , Return
> >
#endif #endif
{ {
#ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY #ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
typedef Return type; typedef Return type;
#endif #endif
}; };
@ -110,13 +110,13 @@ namespace boost
struct iterator_facade_types struct iterator_facade_types
{ {
typedef iterator_tag<AccessCategory, TraversalCategory> iterator_category; typedef iterator_tag<AccessCategory, TraversalCategory> iterator_category;
typedef typename remove_cv<Value>::type value_type; typedef typename remove_cv<Value>::type value_type;
typedef Difference difference_type; typedef Difference difference_type;
typedef typename const_qualified_ptr<Value, AccessCategory>::type pointer; typedef typename const_qualified_ptr<Value, AccessCategory>::type pointer;
// The use_default support is needed for iterator_adaptor. // The use_default support is needed for iterator_adaptor.
// For practical reasons iterator_adaptor needs to specify // For practical reasons iterator_adaptor needs to specify
// a fixed number of template arguments of iterator_facade. // a fixed number of template arguments of iterator_facade.
@ -133,25 +133,25 @@ namespace boost
|| BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, BOOST_TESTED_AT(310))) \ || BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, BOOST_TESTED_AT(310))) \
|| BOOST_WORKAROUND(BOOST_RWSTD_VER, BOOST_TESTED_AT(0x20101)) \ || 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
// combinations, user-defined iterators must be derived from // combinations, user-defined iterators must be derived from
// std::iterator. It is possible to implement a standard // std::iterator. It is possible to implement a standard
// library for broken compilers without this limitation. // library for broken compilers without this limitation.
# define BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE 1 # define BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE 1
typedef typedef
iterator<iterator_category, value_type, difference_type, pointer, reference> iterator<iterator_category, value_type, difference_type, pointer, reference>
base; base;
# endif # endif
}; };
// operator->() needs special support for input iterators to strictly meet the // operator->() needs special support for input iterators to strictly meet the
// 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 a (constant) lvalue to which a pointer can be formed. We do that by // produce a (constant) lvalue to which a pointer can be formed. We do that by
// returning an instantiation of this special proxy class template. // returning an instantiation of this special proxy class template.
template <class T> template <class T>
struct operator_arrow_proxy struct operator_arrow_proxy
{ {
@ -177,13 +177,13 @@ namespace boost
, Pointer , Pointer
, operator_arrow_proxy<Value> , operator_arrow_proxy<Value>
>::type type; >::type type;
static type make(Reference x) static type make(Reference x)
{ {
return type(&x); return type(&x);
} }
}; };
# if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) # if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
// Deal with ETI // Deal with ETI
template<> template<>
@ -218,7 +218,7 @@ namespace boost
*m_iter = val; *m_iter = val;
return *this; return *this;
} }
private: private:
Iterator m_iter; Iterator m_iter;
}; };
@ -227,13 +227,13 @@ namespace boost
struct operator_brackets_result struct operator_brackets_result
{ {
typedef typename access_category_tag<Category,Reference>::type access_category; typedef typename access_category_tag<Category,Reference>::type access_category;
typedef is_tag<writable_iterator_tag, access_category> use_proxy; typedef is_tag<writable_iterator_tag, access_category> use_proxy;
typedef typename mpl::if_< typedef typename mpl::if_<
use_proxy use_proxy
, operator_brackets_proxy<Iterator> , operator_brackets_proxy<Iterator>
, ValueType , ValueType
>::type type; >::type type;
}; };
@ -286,7 +286,7 @@ namespace boost
// to work in the absence of member template friends. // to work in the absence of member template friends.
public: public:
# else # else
template <class I, class V, class AC, class TC, class R, class D> friend class iterator_facade; template <class I, class V, class AC, class TC, class R, class D> friend class iterator_facade;
# define BOOST_ITERATOR_FACADE_RELATION(op) \ # define BOOST_ITERATOR_FACADE_RELATION(op) \
@ -306,21 +306,21 @@ namespace boost
; ;
BOOST_ITERATOR_FACADE_PLUS_HEAD( BOOST_ITERATOR_FACADE_PLUS_HEAD(
friend friend
, (iterator_facade<Derived, V, AC, TC, R, D> const& , (iterator_facade<Derived, V, AC, TC, R, D> const&
, typename Derived::difference_type) , typename Derived::difference_type)
) )
; ;
BOOST_ITERATOR_FACADE_PLUS_HEAD( BOOST_ITERATOR_FACADE_PLUS_HEAD(
friend friend
, (typename Derived::difference_type , (typename Derived::difference_type
, iterator_facade<Derived, V, AC, TC, R, D> const&) , iterator_facade<Derived, V, AC, TC, R, D> const&)
) )
; ;
# endif # endif
template <class Facade> template <class Facade>
static typename Facade::reference dereference(Facade const& f) static typename Facade::reference dereference(Facade const& f)
{ {
@ -372,7 +372,7 @@ namespace boost
, class Value , class Value
, class AccessCategory , class AccessCategory
, class TraversalCategory , class TraversalCategory
, class Reference = BOOST_DEDUCED_TYPENAME detail::const_qualified_ref<Value, AccessCategory>::type , class Reference = BOOST_DEDUCED_TYPENAME ::boost::detail::const_qualified_ref<Value, AccessCategory>::type
, class Difference = std::ptrdiff_t , class Difference = std::ptrdiff_t
> >
class iterator_facade class iterator_facade
@ -381,7 +381,7 @@ namespace boost
Value, AccessCategory, TraversalCategory, Reference, Difference Value, AccessCategory, TraversalCategory, Reference, Difference
>::base >::base
# undef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE # undef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE
# endif # endif
{ {
private: private:
typedef typename typedef typename
@ -392,13 +392,13 @@ namespace boost
// Curiously Recursive Template interface. // Curiously Recursive Template interface.
// //
typedef Derived derived_t; typedef Derived derived_t;
Derived& derived() Derived& derived()
{ {
return static_cast<Derived&>(*this); return static_cast<Derived&>(*this);
} }
Derived const& derived() const Derived const& derived() const
{ {
return static_cast<Derived const&>(*this); return static_cast<Derived const&>(*this);
} }
@ -429,14 +429,14 @@ namespace boost
, pointer , pointer
>::make(*this->derived()); >::make(*this->derived());
} }
typename detail::operator_brackets_result<Derived,value_type,iterator_category,reference>::type typename detail::operator_brackets_result<Derived,value_type,iterator_category,reference>::type
operator[](difference_type n) const operator[](difference_type n) const
{ {
typedef typename typedef typename
detail::operator_brackets_result<Derived,value_type,iterator_category,reference>::use_proxy detail::operator_brackets_result<Derived,value_type,iterator_category,reference>::use_proxy
use_proxy; use_proxy;
return detail::make_operator_brackets_result<Derived>(this->derived() + n, use_proxy()); return detail::make_operator_brackets_result<Derived>(this->derived() + n, use_proxy());
} }
@ -452,32 +452,32 @@ namespace boost
++*this; ++*this;
return tmp; return tmp;
} }
Derived& operator--() Derived& operator--()
{ {
iterator_core_access::decrement(this->derived()); iterator_core_access::decrement(this->derived());
return this->derived(); return this->derived();
} }
Derived operator--(int) Derived operator--(int)
{ {
Derived tmp(this->derived()); Derived tmp(this->derived());
--*this; --*this;
return tmp; return tmp;
} }
Derived& operator+=(difference_type n) Derived& operator+=(difference_type n)
{ {
iterator_core_access::advance(this->derived(), n); iterator_core_access::advance(this->derived(), n);
return this->derived(); return this->derived();
} }
Derived& operator-=(difference_type n) Derived& operator-=(difference_type n)
{ {
iterator_core_access::advance(this->derived(), -n); iterator_core_access::advance(this->derived(), -n);
return this->derived(); return this->derived();
} }
Derived operator-(difference_type x) const Derived operator-(difference_type x) const
{ {
Derived result(this->derived()); Derived result(this->derived());
@ -494,11 +494,11 @@ namespace boost
{ {
return *this; return *this;
} }
# endif # endif
}; };
// //
// Operator implementation. The library supplied operators // Operator implementation. The library supplied operators
// enables the user to provide fully interoperable constant/mutable // enables the user to provide fully interoperable constant/mutable
// iterator types. I.e. the library provides all operators // iterator types. I.e. the library provides all operators
// for all mutable/constant iterator combinations. // for all mutable/constant iterator combinations.
@ -507,12 +507,12 @@ namespace boost
// iterators is not required by the standard for container iterators. // iterators is not required by the standard for container iterators.
// All the standard asks for is a conversion mutable -> constant. // All the standard asks for is a conversion mutable -> constant.
// Most standard library implementations nowadays provide fully interoperable // Most standard library implementations nowadays provide fully interoperable
// iterator implementations, but there are still heavily used implementations // iterator implementations, but there are still heavily used implementations
// that do not provide them. (Actually it's even worse, they do not provide // that do not provide them. (Actually it's even worse, they do not provide
// them for only a few iterators.) // them for only a few iterators.)
// //
// ?? Maybe a BOOST_ITERATOR_NO_FULL_INTEROPERABILITY macro should // ?? Maybe a BOOST_ITERATOR_NO_FULL_INTEROPERABILITY macro should
// enable the user to turn off mixed type operators // enable the user to turn off mixed type operators
// //
// The library takes care to provide only the right operator overloads. // The library takes care to provide only the right operator overloads.
// I.e. // I.e.
@ -530,7 +530,7 @@ namespace boost
// deficiencies result in less strict error checking and more obscure // deficiencies result in less strict error checking and more obscure
// error messages, functionality is not affected. // error messages, functionality is not affected.
// //
// For full operation compiler support for "Substitution Failure Is Not An Error" // For full operation compiler support for "Substitution Failure Is Not An Error"
// (aka. enable_if) and boost::is_convertible is required. // (aka. enable_if) and boost::is_convertible is required.
// //
// The following problems occur if support is lacking. // The following problems occur if support is lacking.
@ -549,7 +549,7 @@ namespace boost
// // false overloads from the templated conversion constructor // // false overloads from the templated conversion constructor
// // of AdaptorA. // // of AdaptorA.
// //
// a1 == a2; // a1 == a2;
// ---------------- // ----------------
// //
// AdaptorA<Iterator> a; // AdaptorA<Iterator> a;
@ -574,7 +574,7 @@ namespace boost
)); \ )); \
return_prefix iterator_core_access::base_op( \ return_prefix iterator_core_access::base_op( \
static_cast<Derived2 const&>(rhs), static_cast<Derived1 const&>(lhs)); \ static_cast<Derived2 const&>(rhs), static_cast<Derived1 const&>(lhs)); \
} }
# define BOOST_ITERATOR_FACADE_RELATION(op, return_prefix, base_op) \ # define BOOST_ITERATOR_FACADE_RELATION(op, return_prefix, base_op) \
BOOST_ITERATOR_FACADE_INTEROP( \ BOOST_ITERATOR_FACADE_INTEROP( \
@ -606,7 +606,7 @@ namespace boost
, distance_to ) , distance_to )
# undef BOOST_ITERATOR_FACADE_INTEROP # undef BOOST_ITERATOR_FACADE_INTEROP
# undef BOOST_ITERATOR_FACADE_INTEROP_HEAD # undef BOOST_ITERATOR_FACADE_INTEROP_HEAD
# define BOOST_ITERATOR_FACADE_PLUS(args) \ # define BOOST_ITERATOR_FACADE_PLUS(args) \
BOOST_ITERATOR_FACADE_PLUS_HEAD(inline, args) \ BOOST_ITERATOR_FACADE_PLUS_HEAD(inline, args) \
{ \ { \
@ -625,7 +625,7 @@ BOOST_ITERATOR_FACADE_PLUS((
)) ))
# undef BOOST_ITERATOR_FACADE_PLUS # undef BOOST_ITERATOR_FACADE_PLUS
# undef BOOST_ITERATOR_FACADE_PLUS_HEAD # undef BOOST_ITERATOR_FACADE_PLUS_HEAD
} // namespace boost } // namespace boost
#include <boost/iterator/detail/config_undef.hpp> #include <boost/iterator/detail/config_undef.hpp>