Compare commits

..

1 Commits

Author SHA1 Message Date
0d612a730d This commit was manufactured by cvs2svn to create tag
'Version_1_26_0'.

[SVN r11842]
2001-11-30 18:24:42 +00:00
5 changed files with 151 additions and 220 deletions

View File

@ -56,7 +56,9 @@
# include <boost/type_traits.hpp>
# include <boost/detail/numeric_traits.hpp>
# include <boost/static_assert.hpp>
# include <boost/limits.hpp>
# ifndef BOOST_NO_LIMITS
# include <limits>
# endif
namespace boost {
@ -133,7 +135,7 @@ namespace detail {
// 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
# if defined(BOOST_HAS_LONG_LONG)
# if defined(ULLONG_MAX) || defined(ULONG_LONG_MAX)
BOOST_STATIC_CONSTANT(bool,
value = (
std::numeric_limits<T>::is_specialized
@ -197,20 +199,15 @@ struct counting_iterator_policies : public default_iterator_policies
template <class Incrementable>
struct counting_iterator_generator
{
typedef typename boost::remove_const<
Incrementable
>::type value_type;
typedef counting_iterator_traits<Incrementable> traits;
typedef counting_iterator_traits<value_type> traits;
typedef iterator_adaptor<
value_type
, counting_iterator_policies<value_type>
, value_type
, value_type const&
, value_type const*
, typename traits::iterator_category
, typename traits::difference_type
typedef iterator_adaptor<Incrementable,
counting_iterator_policies<Incrementable>,
Incrementable,
const Incrementable&,
const Incrementable*,
typename traits::iterator_category,
typename traits::difference_type
> type;
};

View File

@ -99,17 +99,17 @@ struct half_open_range
public:
typedef iter_t const_iterator;
typedef typename iterator::value_type value_type;
typedef typename iterator::difference_type difference_type;
typedef typename iterator::reference reference;
typedef typename iterator::reference const_reference;
typedef typename iterator::pointer pointer;
typedef typename iterator::pointer const_pointer;
typedef typename counting_iterator_traits<Incrementable>::value_type value_type;
typedef typename counting_iterator_traits<Incrementable>::difference_type difference_type;
typedef typename counting_iterator_traits<Incrementable>::reference reference;
typedef typename counting_iterator_traits<Incrementable>::reference const_reference;
typedef typename counting_iterator_traits<Incrementable>::pointer pointer;
typedef typename counting_iterator_traits<Incrementable>::pointer const_pointer;
// It would be nice to select an unsigned type, but this is appropriate
// since the library makes an attempt to select a difference_type which can
// hold the difference between any two iterators.
typedef typename iterator::difference_type size_type;
typedef typename counting_iterator_traits<Incrementable>::difference_type size_type;
half_open_range(Incrementable start, Incrementable finish)
: m_start(start),

View File

@ -12,16 +12,6 @@
//
// Revision History:
// 01 Feb 2002 Jeremy Siek
// Added more comments in default_iterator_policies.
// 08 Jan 2001 David Abrahams
// Moved concept checks into a separate class, which makes MSVC
// better at dealing with them.
// 07 Jan 2001 David Abrahams
// Choose proxy for operator->() only if the reference type is not a reference.
// Updated workarounds for __MWERKS__ == 0x2406
// 20 Dec 2001 David Abrahams
// Adjusted is_convertible workarounds for __MWERKS__ == 0x2406
// 03 Nov 2001 Jeremy Siek
// Changed the named template parameter interface and internal.
// 04 Oct 2001 Jeremy Siek
@ -129,7 +119,7 @@
// I was having some problems with VC6. I couldn't tell whether our hack for
// stock GCC was causing problems so I needed an easy way to turn it on and
// off. Now we can test the hack with various compilers and still have an
// off. Now we can test the hack with various compilers and still have an
// "out" if it doesn't work. -dwa 7/31/00
# if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 && !defined(__STL_USE_NAMESPACES)
# define BOOST_RELOPS_AMBIGUITY_BUG 1
@ -147,7 +137,7 @@ namespace boost {
template <class Policies, class Adapted, class Traits>
struct TrivialIteratorPoliciesConcept
{
typedef typename Traits::reference reference;
typedef typename Traits::reference Reference;
void constraints() {
function_requires< AssignableConcept<Policies> >();
function_requires< DefaultConstructibleConcept<Policies> >();
@ -157,7 +147,7 @@ struct TrivialIteratorPoliciesConcept
const_constraints();
}
void const_constraints() const {
reference r = p.dereference(x);
Reference r = p.dereference(x);
b = p.equal(x, x);
ignore_unused_variable_warning(r);
}
@ -173,7 +163,7 @@ struct ForwardIteratorPoliciesConcept
{
typedef typename Traits::iterator_category iterator_category;
void constraints() {
function_requires<
function_requires<
TrivialIteratorPoliciesConcept<Policies, Adapted, Traits>
>();
@ -191,7 +181,7 @@ struct BidirectionalIteratorPoliciesConcept
{
typedef typename Traits::iterator_category iterator_category;
void constraints() {
function_requires<
function_requires<
ForwardIteratorPoliciesConcept<Policies, Adapted, Traits>
>();
@ -209,7 +199,7 @@ struct RandomAccessIteratorPoliciesConcept
typedef typename Traits::difference_type DifferenceType;
typedef typename Traits::iterator_category iterator_category;
void constraints() {
function_requires<
function_requires<
BidirectionalIteratorPoliciesConcept<Policies, Adapted, Traits>
>();
@ -233,15 +223,9 @@ struct RandomAccessIteratorPoliciesConcept
// class if you want to customize particular policies.
struct default_iterator_policies
{
// Some of the member functions were defined static, but Borland
// got confused and thought they were non-const. Also, Sun C++
// does not like static function templates.
//
// The reason some members were defined static is because there is
// not state (data members) needed by those members of the
// default_iterator_policies class. If your policies class member
// functions need to access state stored in the policies object,
// then the member functions should not be static (they can't be).
// Some of these members were defined static, but Borland got confused
// and thought they were non-const. Also, Sun C++ does not like static
// function templates.
template <class Base>
void initialize(Base&)
@ -273,7 +257,7 @@ struct default_iterator_policies
{ return x.base() == y.base(); }
};
// putting the comparisons in a base class avoids the g++
// putting the comparisons in a base class avoids the g++
// ambiguous overload bug due to the relops operators
#ifdef BOOST_RELOPS_AMBIGUITY_BUG
@ -281,7 +265,7 @@ template <class Derived, class Base>
struct iterator_comparisons : Base { };
template <class D1, class D2, class Base1, class Base2>
inline bool operator==(const iterator_comparisons<D1,Base1>& xb,
inline bool operator==(const iterator_comparisons<D1,Base1>& xb,
const iterator_comparisons<D2,Base2>& yb)
{
const D1& x = static_cast<const D1&>(xb);
@ -290,7 +274,7 @@ inline bool operator==(const iterator_comparisons<D1,Base1>& xb,
}
template <class D1, class D2, class Base1, class Base2>
inline bool operator!=(const iterator_comparisons<D1,Base1>& xb,
inline bool operator!=(const iterator_comparisons<D1,Base1>& xb,
const iterator_comparisons<D2,Base2>& yb)
{
const D1& x = static_cast<const D1&>(xb);
@ -299,7 +283,7 @@ inline bool operator!=(const iterator_comparisons<D1,Base1>& xb,
}
template <class D1, class D2, class Base1, class Base2>
inline bool operator<(const iterator_comparisons<D1,Base1>& xb,
inline bool operator<(const iterator_comparisons<D1,Base1>& xb,
const iterator_comparisons<D2,Base2>& yb)
{
const D1& x = static_cast<const D1&>(xb);
@ -308,16 +292,16 @@ inline bool operator<(const iterator_comparisons<D1,Base1>& xb,
}
template <class D1, class D2, class Base1, class Base2>
inline bool operator>(const iterator_comparisons<D1,Base1>& xb,
inline bool operator>(const iterator_comparisons<D1,Base1>& xb,
const iterator_comparisons<D2,Base2>& yb)
{
{
const D1& x = static_cast<const D1&>(xb);
const D2& y = static_cast<const D2&>(yb);
return x.policies().distance(y, x) > 0;
}
template <class D1, class D2, class Base1, class Base2>
inline bool operator>=(const iterator_comparisons<D1,Base1>& xb,
inline bool operator>=(const iterator_comparisons<D1,Base1>& xb,
const iterator_comparisons<D2,Base2>& yb)
{
const D1& x = static_cast<const D1&>(xb);
@ -326,7 +310,7 @@ inline bool operator>=(const iterator_comparisons<D1,Base1>& xb,
}
template <class D1, class D2, class Base1, class Base2>
inline bool operator<=(const iterator_comparisons<D1,Base1>& xb,
inline bool operator<=(const iterator_comparisons<D1,Base1>& xb,
const iterator_comparisons<D2,Base2>& yb)
{
const D1& x = static_cast<const D1&>(xb);
@ -366,14 +350,17 @@ namespace detail {
return &(*i);
}
template <class Value, class Reference, class Pointer>
template <class Category, class Value, class Pointer>
struct operator_arrow_result_generator
{
typedef operator_arrow_proxy<Value> proxy;
// Borland chokes unless it's an actual enum (!)
enum { use_proxy = !boost::is_reference<Reference>::value };
typedef typename boost::detail::if_true<(use_proxy)>::template
enum { is_input_iter
= (boost::is_convertible<Category*,std::input_iterator_tag*>::value
& !boost::is_convertible<Category*,std::forward_iterator_tag*>::value)
};
typedef typename boost::detail::if_true<(is_input_iter)>::template
then<
proxy,
// else
@ -382,7 +369,7 @@ namespace detail {
};
# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_STD_ITERATOR_TRAITS)
# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
// Select default pointer and reference types for adapted non-pointer
// iterators based on the iterator and the value_type. Poor man's partial
@ -435,14 +422,14 @@ namespace detail {
typename iterator_traits<Iterator>::pointer,
Value*
>::type pointer;
typedef typename if_true<(
::boost::is_same<Value,typename iterator_traits<Iterator>::value_type>::value
)>::template then<
typename iterator_traits<Iterator>::reference,
Value&
>::type reference;
};
# endif
@ -491,8 +478,8 @@ namespace detail {
template <class Base, class Traits>
struct select {
typedef typename Traits::value_type Value;
typedef typename boost::detail::iterator_defaults<Base,Value>::pointer
type;
typedef typename boost::detail::iterator_defaults<Base,Value>::pointer
type;
};
};
template <> struct default_generator<default_pointer>
@ -502,8 +489,8 @@ namespace detail {
template <class Base, class Traits>
struct select {
typedef typename Traits::value_type Value;
typedef typename boost::detail::iterator_defaults<Base,Value>::reference
type;
typedef typename boost::detail::iterator_defaults<Base,Value>::reference
type;
};
};
template <> struct default_generator<default_reference>
@ -551,7 +538,7 @@ template <class Difference> struct difference_type_is
{
typedef detail::cons_type<detail::difference_type_tag, Difference> type;
};
template <class IteratorCategory> struct iterator_category_is
template <class IteratorCategory> struct iterator_category_is
: public named_template_param_base
{
typedef detail::cons_type<detail::iterator_category_tag, IteratorCategory> type;
@ -565,7 +552,7 @@ namespace detail {
// An associative list is a list of key-value pairs. The list is
// built out of cons_type's and is terminated by end_of_list.
# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(__BORLANDC__)
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(__BORLANDC__)
template <class AssocList, class Key>
struct find_param;
@ -575,7 +562,7 @@ namespace detail {
typedef typename Head::first_type Key1;
typedef typename Head::second_type Value;
typedef typename if_true<(is_same<Key1, Key2>::value)>::template
then<Value,
then<Value,
typename find_param<typename AssocList::second_type, Key2>::type
>::type type;
};
@ -594,7 +581,7 @@ namespace detail {
typedef typename find_param_helper1<AssocList>::type select1;
typedef typename select1::template select<AssocList, Key>::type type;
};
# else
#else
template <class AssocList, class Key> struct find_param;
template <class Key>
@ -611,7 +598,7 @@ namespace detail {
struct find_param<detail::cons_type< detail::cons_type<Key1, Value>, Rest>, Key2> {
typedef typename find_param<Rest, Key2>::type type;
};
# endif
#endif
struct make_named_arg {
template <class Key, class Value>
@ -625,29 +612,29 @@ namespace detail {
template <class Value>
struct is_named_parameter
{
enum { value = is_convertible< typename add_reference< Value >::type, add_reference< named_template_param_base >::type >::value };
enum { value = is_convertible<Value, named_template_param_base>::value };
};
# if defined(__MWERKS__) && __MWERKS__ <= 0x2406 // workaround for broken is_convertible implementation
#if defined(__MWERKS__) && __MWERKS__ <= 0x2405 // workaround for broken is_convertible implementation
template <class T> struct is_named_parameter<value_type_is<T> > { enum { value = true }; };
template <class T> struct is_named_parameter<reference_is<T> > { enum { value = true }; };
template <class T> struct is_named_parameter<pointer_is<T> > { enum { value = true }; };
template <class T> struct is_named_parameter<difference_type_is<T> > { enum { value = true }; };
template <class T> struct is_named_parameter<iterator_category_is<T> > { enum { value = true }; };
# endif
#endif
template <class Key, class Value>
struct make_arg {
# ifdef __BORLANDC__
#ifdef __BORLANDC__
// Borland C++ doesn't like the extra indirection of is_named_parameter
typedef typename
typedef typename
if_true<(is_convertible<Value,named_template_param_base>::value)>::
template then<make_named_arg, make_key_value>::type Make;
# else
#else
enum { is_named = is_named_parameter<Value>::value };
typedef typename if_true<(is_named)>::template
then<make_named_arg, make_key_value>::type Make;
# endif
#endif
typedef typename Make::template select<Key, Value>::type type;
};
@ -691,7 +678,7 @@ namespace detail {
class iterator_adaptor_traits_gen
{
// Form an associative list out of the template parameters
// If the argument is a normal parameter (not named) then make_arg
// If the argument is a normal parameter (not named) then make_arg
// creates a key-value pair. If the argument is a named parameter,
// then make_arg extracts the key-value pair defined inside the
// named parameter.
@ -716,9 +703,9 @@ namespace detail {
typedef typename resolve_default<Val, default_value_type, Base, Traits0>::type
value_type;
// if getting default value type from iterator_traits, then it won't be const
typedef typename resolve_default<Diff, default_difference_type, Base,
typedef typename resolve_default<Diff, default_difference_type, Base,
Traits0>::type difference_type;
typedef typename resolve_default<Cat, default_iterator_category, Base,
typedef typename resolve_default<Cat, default_iterator_category, Base,
Traits0>::type iterator_category;
typedef boost::iterator<iterator_category, value_type, difference_type,
@ -731,47 +718,26 @@ namespace detail {
pointer;
typedef typename resolve_default<Ref, default_reference, Base, Traits1>::type
reference;
public:
typedef boost::iterator<iterator_category,
typename remove_const<value_type>::type,
typename remove_const<value_type>::type,
difference_type, pointer, reference> type;
};
// This is really a partial concept check for iterators. Should it
// be moved or done differently?
template <class Category, class Value, class Difference, class Pointer, class Reference>
struct validator
{
BOOST_STATIC_CONSTANT(
bool, is_input_or_output_iter
= (boost::is_convertible<Category*,std::input_iterator_tag*>::value
| boost::is_convertible<Category*,std::output_iterator_tag*>::value));
// Iterators should satisfy one of the known categories
BOOST_STATIC_ASSERT(is_input_or_output_iter);
// Iterators >= ForwardIterator must produce real references
// as required by the C++ standard requirements in Table 74.
BOOST_STATIC_CONSTANT(
bool, forward_iter_with_real_reference
= ((!boost::is_convertible<Category*,std::forward_iterator_tag*>::value)
| boost::is_same<Reference,Value&>::value
| boost::is_same<Reference,typename add_const<Value>::type&>::value));
BOOST_STATIC_ASSERT(forward_iter_with_real_reference);
};
} // namespace detail
// This macro definition is only temporary in this file
# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
# if !defined(BOOST_MSVC)
# define BOOST_ARG_DEPENDENT_TYPENAME typename
# else
# define BOOST_ARG_DEPENDENT_TYPENAME
# endif
template <class T> struct undefined;
//============================================================================
//iterator_adaptor - Adapts a generic piece of data as an iterator. Adaptation
// is especially easy if the data being adapted is itself an iterator
@ -800,12 +766,12 @@ namespace detail {
//
// Distance - the difference_type of the resulting iterator. If not
// supplied, iterator_traits<Base>::difference_type is used.
template <class Base, class Policies,
class Value = ::boost::detail::default_argument,
class Reference = ::boost::detail::default_argument,
class Pointer = ::boost::detail::default_argument,
class Category = ::boost::detail::default_argument,
class Distance = ::boost::detail::default_argument
template <class Base, class Policies,
class Value = detail::default_argument,
class Reference = detail::default_argument,
class Pointer = detail::default_argument,
class Category = detail::default_argument,
class Distance = detail::default_argument
>
struct iterator_adaptor :
#ifdef BOOST_RELOPS_AMBIGUITY_BUG
@ -832,19 +798,32 @@ struct iterator_adaptor :
typedef Policies policies_type;
private:
typedef detail::validator<
iterator_category,value_type,difference_type,pointer,reference
> concept_check;
BOOST_STATIC_CONSTANT(bool, is_input_or_output_iter
= (boost::is_convertible<iterator_category*,std::input_iterator_tag*>::value
|| boost::is_convertible<iterator_category*,std::output_iterator_tag*>::value));
// Iterators should satisfy one of the known categories
BOOST_STATIC_ASSERT(is_input_or_output_iter);
#if !defined(BOOST_MSVC)
// Iterators >= ForwardIterator must produce real references
// as required by the C++ standard requirements in Table 74.
BOOST_STATIC_CONSTANT(bool, forward_iter_with_real_reference =
(!boost::is_convertible<iterator_category*,std::forward_iterator_tag*>::value
|| boost::is_same<reference,value_type&>::value
|| boost::is_same<reference,const value_type&>::value));
// This check gives incorrect results in iter_traits_gen_test.cpp
BOOST_STATIC_ASSERT(forward_iter_with_real_reference);
#endif
public:
iterator_adaptor()
{
}
iterator_adaptor() { }
explicit
iterator_adaptor(const Base& it, const Policies& p = Policies())
: m_iter_p(it, p) {
policies().initialize(base());
policies().initialize(base());
}
template <class Iter2, class Value2, class Pointer2, class Reference2>
@ -855,9 +834,9 @@ struct iterator_adaptor :
policies().initialize(base());
}
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__BORLANDC__)
#if defined(BOOST_MSVC) || defined(__BORLANDC__)
// This is required to prevent a bug in how VC++ generates
// the assignment operator for compressed_pair
// the assignment operator for compressed_pairv
iterator_adaptor& operator= (const iterator_adaptor& x) {
m_iter_p = x.m_iter_p;
return *this;
@ -872,7 +851,7 @@ struct iterator_adaptor :
# pragma warning( disable : 4284 )
#endif
typename boost::detail::operator_arrow_result_generator<value_type,reference,pointer>::type
typename boost::detail::operator_arrow_result_generator<iterator_category,value_type,pointer>::type
operator->() const
{ return detail::operator_arrow(*this, iterator_category()); }
@ -882,7 +861,7 @@ struct iterator_adaptor :
value_type operator[](difference_type n) const
{ return *(*this + n); }
self& operator++() {
#if !defined(__MWERKS__) || __MWERKS__ >= 0x2405
policies().increment(*this);
@ -895,7 +874,7 @@ struct iterator_adaptor :
}
self operator++(int) { self tmp(*this); ++*this; return tmp; }
self& operator--() {
#if !defined(__MWERKS__) || __MWERKS__ >= 0x2405
policies().decrement(*this);
@ -904,14 +883,14 @@ struct iterator_adaptor :
#endif
return *this;
}
self operator--(int) { self tmp(*this); --*this; return tmp; }
self& operator+=(difference_type n) {
policies().advance(*this, n);
return *this;
}
self& operator-=(difference_type n) {
policies().advance(*this, -n);
return *this;
@ -969,7 +948,7 @@ operator-(
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
class Reference1, class Reference2, class Pointer1, class Pointer2,
class Category, class Distance>
inline bool
inline bool
operator==(
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Pointer1,Category,Distance>& x,
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Pointer2,Category,Distance>& y)
@ -980,7 +959,7 @@ operator==(
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
class Reference1, class Reference2, class Pointer1, class Pointer2,
class Category, class Distance>
inline bool
inline bool
operator<(
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Pointer1,Category,Distance>& x,
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Pointer2,Category,Distance>& y)
@ -991,18 +970,18 @@ operator<(
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
class Reference1, class Reference2, class Pointer1, class Pointer2,
class Category, class Distance>
inline bool
inline bool
operator>(
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Pointer1,Category,Distance>& x,
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Pointer2,Category,Distance>& y)
{
{
return x.policies().distance(y, x) > 0;
}
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
class Reference1, class Reference2, class Pointer1, class Pointer2,
class Category, class Distance>
inline bool
inline bool
operator>=(
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Pointer1,Category,Distance>& x,
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Pointer2,Category,Distance>& y)
@ -1013,7 +992,7 @@ operator>=(
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
class Reference1, class Reference2, class Pointer1, class Pointer2,
class Category, class Distance>
inline bool
inline bool
operator<=(
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Pointer1,Category,Distance>& x,
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Pointer2,Category,Distance>& y)
@ -1024,9 +1003,9 @@ operator<=(
template <class Iterator1, class Iterator2, class Policies, class Value1, class Value2,
class Reference1, class Reference2, class Pointer1, class Pointer2,
class Category, class Distance>
inline bool
inline bool
operator!=(
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Pointer1,Category,Distance>& x,
const iterator_adaptor<Iterator1,Policies,Value1,Reference1,Pointer1,Category,Distance>& x,
const iterator_adaptor<Iterator2,Policies,Value2,Reference2,Pointer2,Category,Distance>& y)
{
return !x.policies().equal(x, y);
@ -1044,7 +1023,7 @@ struct transform_iterator_policies : public default_iterator_policies
{
transform_iterator_policies() { }
transform_iterator_policies(const AdaptableUnaryFunction& f) : m_f(f) { }
template <class IteratorAdaptor>
typename IteratorAdaptor::reference
dereference(const IteratorAdaptor& iter) const
@ -1058,7 +1037,7 @@ class transform_iterator_generator
{
typedef typename AdaptableUnaryFunction::result_type value_type;
public:
typedef iterator_adaptor<Iterator,
typedef iterator_adaptor<Iterator,
transform_iterator_policies<AdaptableUnaryFunction>,
value_type, value_type, value_type*, std::input_iterator_tag>
type;
@ -1097,7 +1076,7 @@ struct indirect_iterator_policies : public default_iterator_policies
};
namespace detail {
# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // strangely instantiated even when unused! Maybe try a recursive template someday ;-)
# if !defined(BOOST_MSVC) // stragely instantiated even when unused! Maybe try a recursive template someday ;-)
template <class T>
struct traits_of_value_type {
typedef typename boost::detail::iterator_traits<T>::value_type outer_value;
@ -1110,12 +1089,12 @@ namespace detail {
template <class OuterIterator, // Mutable or Immutable, does not matter
class Value
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
#if !defined(BOOST_MSVC)
= BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type<
OuterIterator>::value_type
#endif
, class Reference
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
, class Reference
#if !defined(BOOST_MSVC)
= BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type<
OuterIterator>::reference
#else
@ -1123,8 +1102,8 @@ template <class OuterIterator, // Mutable or Immutable, does not matter
#endif
, class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<
OuterIterator>::iterator_category
, class Pointer
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
, class Pointer
#if !defined(BOOST_MSVC)
= BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type<
OuterIterator>::pointer
#else
@ -1139,28 +1118,28 @@ struct indirect_iterator_generator
template <class OuterIterator, // Mutable or Immutable, does not matter
class Value
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
#if !defined(BOOST_MSVC)
= BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type<
OuterIterator>::value_type
#endif
, class Reference
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
, class Reference
#if !defined(BOOST_MSVC)
= BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type<
OuterIterator>::reference
#else
= Value &
#endif
, class ConstReference = Value const&
, class ConstReference = const Value&
, class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<
OuterIterator>::iterator_category
, class Pointer
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
, class Pointer
#if !defined(BOOST_MSVC)
= BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type<
OuterIterator>::pointer
#else
= Value*
#endif
, class ConstPointer = Value const*
, class ConstPointer = const Value*
>
struct indirect_iterator_pair_generator
{
@ -1170,7 +1149,7 @@ struct indirect_iterator_pair_generator
Value, ConstReference,Category,ConstPointer>::type const_iterator;
};
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
#ifndef BOOST_MSVC
template <class OuterIterator>
inline typename indirect_iterator_generator<OuterIterator>::type
make_indirect_iterator(OuterIterator base)
@ -1189,29 +1168,29 @@ struct reverse_iterator_policies : public default_iterator_policies
template <class IteratorAdaptor>
typename IteratorAdaptor::reference dereference(const IteratorAdaptor& x) const
{ return *boost::prior(x.base()); }
template <class BidirectionalIterator>
void increment(BidirectionalIterator& x) const
{ --x.base(); }
template <class BidirectionalIterator>
void decrement(BidirectionalIterator& x) const
{ ++x.base(); }
template <class BidirectionalIterator, class DifferenceType>
void advance(BidirectionalIterator& x, DifferenceType n) const
{ x.base() -= n; }
template <class Iterator1, class Iterator2>
typename Iterator1::difference_type distance(
const Iterator1& x, const Iterator2& y) const
{ return x.base() - y.base(); }
template <class Iterator1, class Iterator2>
bool equal(const Iterator1& x, const Iterator2& y) const
{ return x.base() == y.base(); }
};
template <class BidirectionalIterator,
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,
@ -1247,7 +1226,7 @@ struct projection_iterator_policies : public default_iterator_policies
return m_f(*iter.base());
}
AdaptableUnaryFunction m_f;
AdaptableUnaryFunction m_f;
};
template <class AdaptableUnaryFunction, class Iterator>
@ -1276,7 +1255,7 @@ struct projection_iterator_pair_generator {
template <class AdaptableUnaryFunction, class Iterator>
inline typename projection_iterator_generator<AdaptableUnaryFunction, Iterator>::type
make_projection_iterator(
Iterator iter,
Iterator iter,
const AdaptableUnaryFunction& f = AdaptableUnaryFunction())
{
typedef typename projection_iterator_generator<AdaptableUnaryFunction, Iterator>::type result_t;
@ -1286,7 +1265,7 @@ make_projection_iterator(
template <class AdaptableUnaryFunction, class Iterator>
inline typename const_projection_iterator_generator<AdaptableUnaryFunction, Iterator>::type
make_const_projection_iterator(
Iterator iter,
Iterator iter,
const AdaptableUnaryFunction& f = AdaptableUnaryFunction())
{
typedef typename const_projection_iterator_generator<AdaptableUnaryFunction, Iterator>::type result_t;
@ -1302,7 +1281,7 @@ class filter_iterator_policies
public:
filter_iterator_policies() { }
filter_iterator_policies(const Predicate& p, const Iterator& end)
filter_iterator_policies(const Predicate& p, const Iterator& end)
: m_predicate(p), m_end(end) { }
void initialize(Iterator& x) {
@ -1356,7 +1335,7 @@ namespace detail {
template <class Iterator>
struct non_bidirectional_category
{
# if !defined(__MWERKS__) || __MWERKS__ > 0x2406
# if !defined(__MWERKS__) || __MWERKS__ > 0x2405
typedef typename reduce_to_base_class<
std::forward_iterator_tag,
typename iterator_traits<Iterator>::iterator_category
@ -1382,7 +1361,7 @@ 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 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,
@ -1392,7 +1371,7 @@ template <class Predicate, class Iterator,
class filter_iterator_generator {
BOOST_STATIC_CONSTANT(bool, is_bidirectional
= (boost::is_convertible<Category*, std::bidirectional_iterator_tag*>::value));
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // I don't have any idea why this occurs, but it doesn't seem to hurt too badly.
#ifndef BOOST_MSVC // I don't have any idea why this occurs, but it doesn't seem to hurt too badly.
BOOST_STATIC_ASSERT(!is_bidirectional);
#endif
typedef filter_iterator_policies<Predicate,Iterator> policies_type;

View File

@ -5,10 +5,6 @@
// test suite for STL concepts such as iterators and containers.
//
// Revision History:
// 28 Apr 2002 Fixed input iterator requirements.
// For a == b a++ == b++ is no longer required.
// See 24.1.1/3 for details.
// (Thomas Witt)
// 08 Feb 2001 Fixed bidirectional iterator test so that
// --i is no longer a precondition.
// (Jeremy Siek)
@ -78,40 +74,22 @@ void mutable_trivial_iterator_test(const Iterator i, const Iterator j, T val)
template <class Iterator, class T>
void input_iterator_test(Iterator i, T v1, T v2)
{
Iterator i1(i);
Iterator i1 = i, i2 = i;
assert(i == i1);
assert(!(i != i1));
assert(i == i1++);
assert(i != ++i2);
// I can see no generic way to create an input iterator
// that is in the domain of== of i and != i.
// The following works for istream_iterator but is not
// guaranteed to work for arbitrary input iterators.
//
// Iterator i2;
//
// assert(i != i2);
// assert(!(i == i2));
trivial_iterator_test(i, i1, v1);
trivial_iterator_test(i, i2, v1);
assert(*i1 == v1);
assert(*i == v1);
// we cannot test for equivalence of (void)++i & (void)i++
// as i is only guaranteed to be single pass.
assert(*i++ == v1);
i1 = i;
assert(i == i1);
assert(!(i != i1));
assert(*i1 == v2);
assert(*i == v2);
// i is dereferencable, so it must be incrementable.
++i;
assert(i == i1);
assert(i == i2);
++i1;
++i2;
// how to test for operator-> ?
trivial_iterator_test(i, i1, v2);
trivial_iterator_test(i, i2, v2);
}
// how to test output iterator?
@ -146,23 +124,6 @@ void forward_iterator_test(Iterator i, T v1, T v2)
{
input_iterator_test(i, v1, v2);
Iterator i1 = i, i2 = i;
assert(i == i1++);
assert(i != ++i2);
trivial_iterator_test(i, i1, v1);
trivial_iterator_test(i, i2, v1);
++i;
assert(i == i1);
assert(i == i2);
++i1;
++i2;
trivial_iterator_test(i, i1, v2);
trivial_iterator_test(i, i2, v2);
// borland doesn't allow non-type template parameters
# if !defined(__BORLANDC__) || (__BORLANDC__ > 0x551)
lvalue_test<(boost::is_pointer<Iterator>::value)>::check(i);

View File

@ -5,9 +5,6 @@
// to its suitability for any purpose.
//
#ifndef boost_permutation_iterator_hpp
#define boost_permutation_iterator_hpp
#include <boost/iterator_adaptors.hpp>
namespace boost {
@ -67,6 +64,3 @@ namespace boost {
}
} // namespace boost
#endif // boost_permutation_iterator_hpp