mirror of
https://github.com/boostorg/iterator.git
synced 2025-06-26 20:41:35 +02:00
Compare commits
1 Commits
svn-branch
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
cafa8de7a6 |
@ -1,215 +0,0 @@
|
|||||||
// (C) Copyright David Abrahams and Jeremy Siek 2000-2001. Permission to copy,
|
|
||||||
// use, modify, sell and distribute this software is granted provided this
|
|
||||||
// copyright notice appears in all copies. This software is provided "as is"
|
|
||||||
// without express or implied warranty, and with no claim as to its suitability
|
|
||||||
// for any purpose.
|
|
||||||
//
|
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
|
||||||
//
|
|
||||||
// Supplies:
|
|
||||||
//
|
|
||||||
// template <class Incrementable> class counting_iterator_traits;
|
|
||||||
// template <class Incrementable> class counting_iterator_policies;
|
|
||||||
//
|
|
||||||
// Iterator traits and policies for adapted iterators whose dereferenced
|
|
||||||
// value progresses through consecutive values of Incrementable when the
|
|
||||||
// iterator is derferenced.
|
|
||||||
//
|
|
||||||
// template <class Incrementable> struct counting_iterator_generator;
|
|
||||||
//
|
|
||||||
// A "type generator" whose nested type "type" is a counting iterator as
|
|
||||||
// described above.
|
|
||||||
//
|
|
||||||
// template <class Incrementable>
|
|
||||||
// typename counting_iterator_generator<Incrementable>::type
|
|
||||||
// make_counting_iterator(Incrementable);
|
|
||||||
//
|
|
||||||
// A function which produces an adapted counting iterator over values of
|
|
||||||
// Incrementable.
|
|
||||||
//
|
|
||||||
// Revision History
|
|
||||||
// 14 Feb 2001 Removed unnecessary typedefs from counting_iterator_traits
|
|
||||||
// (Jeremy Siek)
|
|
||||||
// 11 Feb 2001 Use BOOST_STATIC_CONSTANT (Dave Abrahams)
|
|
||||||
// 11 Feb 2001 Clean up after John Maddocks's (finally effective!) Borland
|
|
||||||
// fixes (David Abrahams).
|
|
||||||
// 10 Feb 2001 Use new iterator_adaptor<> interface (David Abrahams)
|
|
||||||
// 10 Feb 2001 Rolled in supposed Borland fixes from John Maddock, but not
|
|
||||||
// seeing any improvement yet (David Abrahams)
|
|
||||||
// 09 Feb 2001 Factored out is_numeric computation. Borland still
|
|
||||||
// unhappy :( (David Abrahams)
|
|
||||||
// 08 Feb 2001 Beginning of a failed attempt to appease Borland
|
|
||||||
// (David Abrahams)
|
|
||||||
// 07 Feb 2001 rename counting_iterator() -> make_counting_iterator()
|
|
||||||
// (David Abrahams)
|
|
||||||
// 04 Feb 2001 Added counting_iterator_generator; updated comments
|
|
||||||
// (David Abrahams)
|
|
||||||
// 24 Jan 2001 initial revision, based on Jeremy Siek's
|
|
||||||
// boost/pending/integer_range.hpp (David Abrahams)
|
|
||||||
|
|
||||||
#ifndef BOOST_COUNTING_ITERATOR_HPP_DWA20000119
|
|
||||||
# define BOOST_COUNTING_ITERATOR_HPP_DWA20000119
|
|
||||||
|
|
||||||
# include <boost/config.hpp>
|
|
||||||
# include <boost/detail/iterator.hpp>
|
|
||||||
# include <boost/iterator_adaptors.hpp>
|
|
||||||
# include <boost/type_traits.hpp>
|
|
||||||
# include <boost/detail/numeric_traits.hpp>
|
|
||||||
# include <boost/static_assert.hpp>
|
|
||||||
# ifndef BOOST_NO_LIMITS
|
|
||||||
# include <limits>
|
|
||||||
# endif
|
|
||||||
|
|
||||||
namespace boost {
|
|
||||||
|
|
||||||
namespace detail {
|
|
||||||
|
|
||||||
// Template class counting_iterator_traits_select -- choose an
|
|
||||||
// iterator_category and difference_type for a counting_iterator at
|
|
||||||
// compile-time based on whether or not it wraps an integer or an iterator,
|
|
||||||
// using "poor man's partial specialization".
|
|
||||||
template <bool is_integer> struct counting_iterator_traits_select;
|
|
||||||
|
|
||||||
// Incrementable is an iterator type
|
|
||||||
template <>
|
|
||||||
struct counting_iterator_traits_select<false>
|
|
||||||
{
|
|
||||||
template <class Incrementable>
|
|
||||||
struct traits
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
typedef boost::detail::iterator_traits<Incrementable> x;
|
|
||||||
public:
|
|
||||||
typedef typename x::iterator_category iterator_category;
|
|
||||||
typedef typename x::difference_type difference_type;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Incrementable is a numeric type
|
|
||||||
template <>
|
|
||||||
struct counting_iterator_traits_select<true>
|
|
||||||
{
|
|
||||||
template <class Incrementable>
|
|
||||||
struct traits
|
|
||||||
{
|
|
||||||
typedef typename
|
|
||||||
boost::detail::numeric_traits<Incrementable>::difference_type
|
|
||||||
difference_type;
|
|
||||||
typedef std::random_access_iterator_tag iterator_category;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Template class distance_policy_select -- choose a policy for computing the
|
|
||||||
// distance between counting_iterators at compile-time based on whether or not
|
|
||||||
// the iterator wraps an integer or an iterator, using "poor man's partial
|
|
||||||
// specialization".
|
|
||||||
|
|
||||||
template <bool is_integer> struct distance_policy_select;
|
|
||||||
|
|
||||||
// A policy for wrapped iterators
|
|
||||||
template <>
|
|
||||||
struct distance_policy_select<false>
|
|
||||||
{
|
|
||||||
template <class Distance, class Incrementable>
|
|
||||||
struct policy {
|
|
||||||
static Distance distance(Incrementable x, Incrementable y)
|
|
||||||
{ return boost::detail::distance(x, y); }
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// A policy for wrapped numbers
|
|
||||||
template <>
|
|
||||||
struct distance_policy_select<true>
|
|
||||||
{
|
|
||||||
template <class Distance, class Incrementable>
|
|
||||||
struct policy {
|
|
||||||
static Distance distance(Incrementable x, Incrementable y)
|
|
||||||
{ return numeric_distance(x, y); }
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Try to detect numeric types at compile time in ways compatible with the
|
|
||||||
// limitations of the compiler and library.
|
|
||||||
template <class T>
|
|
||||||
struct is_numeric {
|
|
||||||
// For a while, this wasn't true, but we rely on it below. This is a regression assert.
|
|
||||||
BOOST_STATIC_ASSERT(::boost::is_integral<char>::value);
|
|
||||||
# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
|
||||||
BOOST_STATIC_CONSTANT(bool, value = std::numeric_limits<T>::is_specialized);
|
|
||||||
# else
|
|
||||||
# if !defined(__BORLANDC__)
|
|
||||||
BOOST_STATIC_CONSTANT(bool, value = (
|
|
||||||
boost::is_convertible<int,T>::value && boost::is_convertible<T,int>::value));
|
|
||||||
# else
|
|
||||||
BOOST_STATIC_CONSTANT(bool, value = ::boost::is_arithmetic<T>::value);
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
};
|
|
||||||
|
|
||||||
// Compute the distance over arbitrary numeric and/or iterator types
|
|
||||||
template <class Distance, class Incrementable>
|
|
||||||
Distance any_distance(Incrementable start, Incrementable finish, Distance* = 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
return distance_policy_select<(
|
|
||||||
is_numeric<Incrementable>::value)>::template
|
|
||||||
policy<Distance, Incrementable>::distance(start, finish);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace detail
|
|
||||||
|
|
||||||
template <class Incrementable>
|
|
||||||
struct counting_iterator_traits {
|
|
||||||
private:
|
|
||||||
typedef ::boost::detail::counting_iterator_traits_select<(
|
|
||||||
::boost::detail::is_numeric<Incrementable>::value
|
|
||||||
)> binder;
|
|
||||||
typedef typename binder::template traits<Incrementable> traits;
|
|
||||||
public:
|
|
||||||
typedef typename traits::difference_type difference_type;
|
|
||||||
typedef typename traits::iterator_category iterator_category;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class Incrementable>
|
|
||||||
struct counting_iterator_policies : public default_iterator_policies
|
|
||||||
{
|
|
||||||
const Incrementable& dereference(type<const Incrementable&>, const Incrementable& i) const
|
|
||||||
{ return i; }
|
|
||||||
|
|
||||||
template <class Difference, class Iterator1, class Iterator2>
|
|
||||||
Difference distance(type<Difference>, const Iterator1& x,
|
|
||||||
const Iterator2& y) const
|
|
||||||
{
|
|
||||||
return boost::detail::any_distance<Difference>(x, y);//,(Difference*)());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// A type generator for counting iterators
|
|
||||||
template <class Incrementable>
|
|
||||||
struct counting_iterator_generator
|
|
||||||
{
|
|
||||||
typedef counting_iterator_traits<Incrementable> traits;
|
|
||||||
|
|
||||||
typedef iterator_adaptor<Incrementable,
|
|
||||||
counting_iterator_policies<Incrementable>,
|
|
||||||
Incrementable,
|
|
||||||
const Incrementable&,
|
|
||||||
typename traits::iterator_category,
|
|
||||||
typename traits::difference_type,
|
|
||||||
const Incrementable*
|
|
||||||
> type;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Manufacture a counting iterator for an arbitrary incrementable type
|
|
||||||
template <class Incrementable>
|
|
||||||
inline typename counting_iterator_generator<Incrementable>::type
|
|
||||||
make_counting_iterator(Incrementable x)
|
|
||||||
{
|
|
||||||
typedef typename counting_iterator_generator<Incrementable>::type result_t;
|
|
||||||
return result_t(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace boost
|
|
||||||
|
|
||||||
#endif // BOOST_COUNTING_ITERATOR_HPP_DWA20000119
|
|
@ -438,6 +438,8 @@ namespace detail {
|
|||||||
# define BOOST_ARG_DEPENDENT_TYPENAME
|
# define BOOST_ARG_DEPENDENT_TYPENAME
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
template <class T> struct undefined;
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//iterator_adaptor - Adapts a generic piece of data as an iterator. Adaptation
|
//iterator_adaptor - Adapts a generic piece of data as an iterator. Adaptation
|
||||||
// is especially easy if the data being adapted is itself an iterator
|
// is especially easy if the data being adapted is itself an iterator
|
||||||
@ -455,35 +457,35 @@ namespace detail {
|
|||||||
// particular, the result type of operator*(). If not supplied but
|
// particular, the result type of operator*(). If not supplied but
|
||||||
// Value is supplied, Value& is used. Otherwise
|
// Value is supplied, Value& is used. Otherwise
|
||||||
// iterator_traits<Base>::reference is used.
|
// iterator_traits<Base>::reference is used.
|
||||||
// Category - the iterator_category of the resulting iterator. If not
|
|
||||||
// supplied, iterator_traits<Base>::iterator_category is used.
|
|
||||||
//
|
|
||||||
// Distance - the difference_type of the resulting iterator. If not
|
|
||||||
// supplied, iterator_traits<Base>::difference_type is used.
|
|
||||||
//
|
//
|
||||||
// Pointer - the pointer type of the resulting iterator, and in
|
// Pointer - the pointer type of the resulting iterator, and in
|
||||||
// particular, the result type of operator->(). If not
|
// particular, the result type of operator->(). If not
|
||||||
// supplied but Value is supplied, Value* is used. Otherwise
|
// supplied but Value is supplied, Value* is used. Otherwise
|
||||||
// iterator_traits<Base>::pointer is used.
|
// iterator_traits<Base>::pointer is used.
|
||||||
//
|
//
|
||||||
|
// Category - the iterator_category of the resulting iterator. If not
|
||||||
|
// supplied, iterator_traits<Base>::iterator_category is used.
|
||||||
|
//
|
||||||
|
// Distance - the difference_type of the resulting iterator. If not
|
||||||
|
// supplied, iterator_traits<Base>::difference_type is used.
|
||||||
template <class Base, class Policies,
|
template <class Base, class Policies,
|
||||||
class Value = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<Base>::value_type,
|
class Value = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<Base>::value_type,
|
||||||
class Reference = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_defaults<Base,Value>::reference,
|
class Reference = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_defaults<Base,Value>::reference,
|
||||||
|
class Pointer = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_defaults<Base,Value>::pointer,
|
||||||
class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<Base>::iterator_category,
|
class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<Base>::iterator_category,
|
||||||
class Distance = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<Base>::difference_type,
|
class Distance = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<Base>::difference_type
|
||||||
class Pointer = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_defaults<Base,Value>::pointer
|
|
||||||
>
|
>
|
||||||
struct iterator_adaptor :
|
struct iterator_adaptor :
|
||||||
#ifdef BOOST_RELOPS_AMBIGUITY_BUG
|
#ifdef BOOST_RELOPS_AMBIGUITY_BUG
|
||||||
iterator_comparisons<
|
iterator_comparisons<
|
||||||
iterator_adaptor<Base,Policies,Value,Reference,Category,Distance,Pointer>,
|
iterator_adaptor<Base,Policies,Value,Reference,Pointer,Category,Distance>,
|
||||||
#endif
|
#endif
|
||||||
boost::iterator<Category,Value,Distance,Pointer,Reference>
|
boost::iterator<Category,Value,Distance,Pointer,Reference>
|
||||||
#ifdef BOOST_RELOPS_AMBIGUITY_BUG
|
#ifdef BOOST_RELOPS_AMBIGUITY_BUG
|
||||||
>
|
>
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
typedef iterator_adaptor<Base,Policies,Value,Reference,Category,Distance,Pointer> self;
|
typedef iterator_adaptor<Base,Policies,Value,Reference,Pointer,Category,Distance> self;
|
||||||
public:
|
public:
|
||||||
typedef Distance difference_type;
|
typedef Distance difference_type;
|
||||||
typedef typename boost::remove_const<Value>::type value_type;
|
typedef typename boost::remove_const<Value>::type value_type;
|
||||||
@ -520,7 +522,7 @@ struct iterator_adaptor :
|
|||||||
|
|
||||||
template <class Iter2, class Value2, class Pointer2, class Reference2>
|
template <class Iter2, class Value2, class Pointer2, class Reference2>
|
||||||
iterator_adaptor (
|
iterator_adaptor (
|
||||||
const iterator_adaptor<Iter2,Policies,Value2,Reference2,Category,Distance,Pointer2>& src)
|
const iterator_adaptor<Iter2,Policies,Value2,Reference2,Pointer2,Category,Distance>& src)
|
||||||
: m_iter_p(src.iter(), src.policies())
|
: m_iter_p(src.iter(), src.policies())
|
||||||
{
|
{
|
||||||
policies().initialize(iter());
|
policies().initialize(iter());
|
||||||
@ -601,99 +603,99 @@ public: // implementation details (too many compilers have trouble when these ar
|
|||||||
const Base& iter() const { return m_iter_p.first(); }
|
const Base& iter() const { return m_iter_p.first(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Base, class Policies, class Value, class Reference,
|
template <class Base, class Policies, class Value, class Reference, class Pointer,
|
||||||
class Category, class Distance1, class Pointer, class Distance2>
|
class Category, class Distance1, class Distance2>
|
||||||
iterator_adaptor<Base,Policies,Value,Reference,Category,Distance1,Pointer>
|
iterator_adaptor<Base,Policies,Value,Reference,Pointer,Category,Distance1>
|
||||||
operator+(
|
operator+(
|
||||||
iterator_adaptor<Base,Policies,Value,Reference,Category,Distance1,Pointer> p,
|
iterator_adaptor<Base,Policies,Value,Reference,Pointer,Category,Distance1> p,
|
||||||
Distance2 x)
|
Distance2 x)
|
||||||
{
|
{
|
||||||
return p += x;
|
return p += x;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Base, class Policies, class Value, class Reference,
|
template <class Base, class Policies, class Value, class Reference, class Pointer,
|
||||||
class Category, class Distance1, class Pointer, class Distance2>
|
class Category, class Distance1, class Distance2>
|
||||||
iterator_adaptor<Base,Policies,Value,Reference,Category,Distance1,Pointer>
|
iterator_adaptor<Base,Policies,Value,Reference,Pointer,Category,Distance1>
|
||||||
operator+(
|
operator+(
|
||||||
Distance2 x,
|
Distance2 x,
|
||||||
iterator_adaptor<Base,Policies,Value,Reference,Category,Distance1,Pointer> p)
|
iterator_adaptor<Base,Policies,Value,Reference,Pointer,Category,Distance1> p)
|
||||||
{
|
{
|
||||||
return p += x;
|
return p += x;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
|
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
|
||||||
class Reference1, class Reference2, class Category,
|
class Reference1, class Reference2, class Pointer1, class Pointer2, class Category,
|
||||||
class Distance, class Pointer1, class Pointer2>
|
class Distance>
|
||||||
Distance operator-(
|
Distance operator-(
|
||||||
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Category,Distance,Pointer1>& x,
|
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Pointer1,Category,Distance>& x,
|
||||||
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Category,Distance,Pointer2>& y)
|
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Pointer2,Category,Distance>& y)
|
||||||
{
|
{
|
||||||
return x.policies().distance(type<Distance>(), y.iter(), x.iter());
|
return x.policies().distance(type<Distance>(), y.iter(), x.iter());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef BOOST_RELOPS_AMBIGUITY_BUG
|
#ifndef BOOST_RELOPS_AMBIGUITY_BUG
|
||||||
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
|
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
|
||||||
class Reference1, class Reference2,
|
class Reference1, class Reference2, class Pointer1, class Pointer2,
|
||||||
class Category, class Distance, class Pointer1, class Pointer2>
|
class Category, class Distance>
|
||||||
inline bool
|
inline bool
|
||||||
operator==(
|
operator==(
|
||||||
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Category,Distance,Pointer1>& x,
|
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Pointer1,Category,Distance>& x,
|
||||||
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Category,Distance,Pointer2>& y)
|
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Pointer2,Category,Distance>& y)
|
||||||
{
|
{
|
||||||
return x.policies().equal(x.iter(), y.iter());
|
return x.policies().equal(x.iter(), y.iter());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
|
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
|
||||||
class Reference1, class Reference2,
|
class Reference1, class Reference2, class Pointer1, class Pointer2,
|
||||||
class Category, class Distance, class Pointer1, class Pointer2>
|
class Category, class Distance>
|
||||||
inline bool
|
inline bool
|
||||||
operator<(
|
operator<(
|
||||||
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Category,Distance,Pointer1>& x,
|
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Pointer1,Category,Distance>& x,
|
||||||
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Category,Distance,Pointer2>& y)
|
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Pointer2,Category,Distance>& y)
|
||||||
{
|
{
|
||||||
return x.policies().less(x.iter(), y.iter());
|
return x.policies().less(x.iter(), y.iter());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
|
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
|
||||||
class Reference1, class Reference2,
|
class Reference1, class Reference2, class Pointer1, class Pointer2,
|
||||||
class Category, class Distance, class Pointer1, class Pointer2>
|
class Category, class Distance>
|
||||||
inline bool
|
inline bool
|
||||||
operator>(
|
operator>(
|
||||||
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Category,Distance,Pointer1>& x,
|
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Pointer1,Category,Distance>& x,
|
||||||
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Category,Distance,Pointer2>& y)
|
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Pointer2,Category,Distance>& y)
|
||||||
{
|
{
|
||||||
return x.policies().less(y.iter(), x.iter());
|
return x.policies().less(y.iter(), x.iter());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
|
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
|
||||||
class Reference1, class Reference2,
|
class Reference1, class Reference2, class Pointer1, class Pointer2,
|
||||||
class Category, class Distance, class Pointer1, class Pointer2>
|
class Category, class Distance>
|
||||||
inline bool
|
inline bool
|
||||||
operator>=(
|
operator>=(
|
||||||
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Category,Distance,Pointer1>& x,
|
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Pointer1,Category,Distance>& x,
|
||||||
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Category,Distance,Pointer2>& y)
|
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Pointer2,Category,Distance>& y)
|
||||||
{
|
{
|
||||||
return !x.policies().less(x.iter(), y.iter());
|
return !x.policies().less(x.iter(), y.iter());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
|
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
|
||||||
class Reference1, class Reference2,
|
class Reference1, class Reference2, class Pointer1, class Pointer2,
|
||||||
class Category, class Distance, class Pointer1, class Pointer2>
|
class Category, class Distance>
|
||||||
inline bool
|
inline bool
|
||||||
operator<=(
|
operator<=(
|
||||||
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Category,Distance,Pointer1>& x,
|
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Pointer1,Category,Distance>& x,
|
||||||
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Category,Distance,Pointer2>& y)
|
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Pointer2,Category,Distance>& y)
|
||||||
{
|
{
|
||||||
return !x.policies().less(y.iter(), x.iter());
|
return !x.policies().less(y.iter(), x.iter());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
|
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
|
||||||
class Reference1, class Reference2,
|
class Reference1, class Reference2, class Pointer1, class Pointer2,
|
||||||
class Category, class Distance, class Pointer1, class Pointer2>
|
class Category, class Distance>
|
||||||
inline bool
|
inline bool
|
||||||
operator!=(
|
operator!=(
|
||||||
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Category,Distance,Pointer1>& x,
|
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Pointer1,Category,Distance>& x,
|
||||||
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Category,Distance,Pointer2>& y)
|
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Pointer2,Category,Distance>& y)
|
||||||
{
|
{
|
||||||
return !x.policies().equal(x.iter(), y.iter());
|
return !x.policies().equal(x.iter(), y.iter());
|
||||||
}
|
}
|
||||||
@ -725,7 +727,7 @@ class transform_iterator_generator
|
|||||||
public:
|
public:
|
||||||
typedef iterator_adaptor<Iterator,
|
typedef iterator_adaptor<Iterator,
|
||||||
transform_iterator_policies<AdaptableUnaryFunction>,
|
transform_iterator_policies<AdaptableUnaryFunction>,
|
||||||
value_type, value_type, std::input_iterator_tag>
|
value_type, value_type, value_type*, std::input_iterator_tag>
|
||||||
type;
|
type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -782,11 +784,8 @@ template <class OuterIterator, // Mutable or Immutable, does not matter
|
|||||||
>
|
>
|
||||||
struct indirect_iterator_generator
|
struct indirect_iterator_generator
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
typedef typename boost::detail::iterator_traits<OuterIterator>::difference_type difference_type;
|
|
||||||
public:
|
|
||||||
typedef iterator_adaptor<OuterIterator,
|
typedef iterator_adaptor<OuterIterator,
|
||||||
indirect_iterator_policies,Value,Reference,Category,difference_type,Pointer> type;
|
indirect_iterator_policies,Value,Reference,Pointer,Category> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class OuterIterator, // Mutable or Immutable, does not matter
|
template <class OuterIterator, // Mutable or Immutable, does not matter
|
||||||
@ -794,14 +793,18 @@ template <class OuterIterator, // Mutable or Immutable, does not matter
|
|||||||
#if !defined(BOOST_MSVC)
|
#if !defined(BOOST_MSVC)
|
||||||
= BOOST_ARG_DEPENDENT_TYPENAME detail::value_type_of_value_type<OuterIterator>::type
|
= BOOST_ARG_DEPENDENT_TYPENAME detail::value_type_of_value_type<OuterIterator>::type
|
||||||
#endif
|
#endif
|
||||||
|
, class Reference = Value&
|
||||||
|
, class ConstReference = const Value&
|
||||||
, class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<OuterIterator>::iterator_category
|
, class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<OuterIterator>::iterator_category
|
||||||
|
, class Pointer = Value*
|
||||||
|
, class ConstPointer = const Value*
|
||||||
>
|
>
|
||||||
struct indirect_iterator_pair_generator
|
struct indirect_iterator_pair_generator
|
||||||
{
|
{
|
||||||
typedef typename indirect_iterator_generator<OuterIterator,
|
typedef typename indirect_iterator_generator<OuterIterator,
|
||||||
Value,Value&,Category,Value*>::type iterator;
|
Value, Reference,Category,Pointer>::type iterator;
|
||||||
typedef typename indirect_iterator_generator<OuterIterator,
|
typedef typename indirect_iterator_generator<OuterIterator,
|
||||||
Value,const Value&,Category,const Value*>::type const_iterator;
|
Value, ConstReference,Category,ConstPointer>::type const_iterator;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef BOOST_MSVC
|
#ifndef BOOST_MSVC
|
||||||
@ -853,14 +856,14 @@ struct reverse_iterator_policies : public default_iterator_policies
|
|||||||
template <class BidirectionalIterator,
|
template <class BidirectionalIterator,
|
||||||
class Value = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<BidirectionalIterator>::value_type,
|
class Value = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<BidirectionalIterator>::value_type,
|
||||||
class Reference = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_defaults<BidirectionalIterator,Value>::reference,
|
class Reference = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_defaults<BidirectionalIterator,Value>::reference,
|
||||||
|
class Pointer = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_defaults<BidirectionalIterator,Value>::pointer,
|
||||||
class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<BidirectionalIterator>::iterator_category,
|
class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<BidirectionalIterator>::iterator_category,
|
||||||
class Distance = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<BidirectionalIterator>::difference_type,
|
class Distance = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<BidirectionalIterator>::difference_type
|
||||||
class Pointer = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_defaults<BidirectionalIterator,Value>::pointer
|
|
||||||
>
|
>
|
||||||
struct reverse_iterator_generator
|
struct reverse_iterator_generator
|
||||||
{
|
{
|
||||||
typedef iterator_adaptor<BidirectionalIterator,reverse_iterator_policies,
|
typedef iterator_adaptor<BidirectionalIterator,reverse_iterator_policies,
|
||||||
Value,Reference,Category,Distance,Pointer> type;
|
Value,Reference,Pointer,Category,Distance> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class BidirectionalIterator>
|
template <class BidirectionalIterator>
|
||||||
@ -900,12 +903,8 @@ template <class AdaptableUnaryFunction, class Iterator>
|
|||||||
class const_projection_iterator_generator {
|
class const_projection_iterator_generator {
|
||||||
typedef typename AdaptableUnaryFunction::result_type value_type;
|
typedef typename AdaptableUnaryFunction::result_type value_type;
|
||||||
typedef projection_iterator_policies<AdaptableUnaryFunction> policies;
|
typedef projection_iterator_policies<AdaptableUnaryFunction> policies;
|
||||||
typedef boost::detail::iterator_traits<Iterator> base_traits;
|
|
||||||
typedef typename base_traits::iterator_category iterator_category;
|
|
||||||
typedef typename base_traits::difference_type difference_type;
|
|
||||||
public:
|
public:
|
||||||
typedef iterator_adaptor<Iterator,policies,value_type,const value_type&,
|
typedef iterator_adaptor<Iterator,policies,value_type,const value_type&,const value_type*> type;
|
||||||
iterator_category,difference_type, const value_type*> type;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class AdaptableUnaryFunction, class Iterator, class ConstIterator>
|
template <class AdaptableUnaryFunction, class Iterator, class ConstIterator>
|
||||||
@ -1020,9 +1019,9 @@ namespace detail {
|
|||||||
template <class Predicate, class Iterator,
|
template <class Predicate, class Iterator,
|
||||||
class Value = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<Iterator>::value_type,
|
class Value = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<Iterator>::value_type,
|
||||||
class Reference = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_defaults<Iterator,Value>::reference,
|
class Reference = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_defaults<Iterator,Value>::reference,
|
||||||
|
class Pointer = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_defaults<Iterator,Value>::pointer,
|
||||||
class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::non_bidirectional_category<Iterator>::type,
|
class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::non_bidirectional_category<Iterator>::type,
|
||||||
class Distance = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<Iterator>::difference_type,
|
class Distance = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<Iterator>::difference_type
|
||||||
class Pointer = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_defaults<Iterator,Value>::pointer
|
|
||||||
>
|
>
|
||||||
class filter_iterator_generator {
|
class filter_iterator_generator {
|
||||||
BOOST_STATIC_CONSTANT(bool, is_bidirectional
|
BOOST_STATIC_CONSTANT(bool, is_bidirectional
|
||||||
@ -1033,7 +1032,7 @@ class filter_iterator_generator {
|
|||||||
typedef filter_iterator_policies<Predicate,Iterator> policies_type;
|
typedef filter_iterator_policies<Predicate,Iterator> policies_type;
|
||||||
public:
|
public:
|
||||||
typedef iterator_adaptor<Iterator,policies_type,
|
typedef iterator_adaptor<Iterator,policies_type,
|
||||||
Value,Reference,Category,Distance,Pointer> type;
|
Value,Reference,Pointer,Category,Distance> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
// This keeps MSVC happy; it doesn't like to deduce default template arguments
|
// This keeps MSVC happy; it doesn't like to deduce default template arguments
|
||||||
|
Reference in New Issue
Block a user