forked from boostorg/iterator
Compare commits
1 Commits
boost-1.20
...
boost-1.19
Author | SHA1 | Date | |
---|---|---|---|
27ffdc21ff |
@ -35,14 +35,14 @@ namespace boost {
|
||||
template <class IntegerType>
|
||||
struct counting_iterator_policies : public default_iterator_policies
|
||||
{
|
||||
IntegerType
|
||||
dereference(type<IntegerType>, const IntegerType& i) const
|
||||
const IntegerType&
|
||||
dereference(type<const IntegerType&>, const IntegerType& i) const
|
||||
{ return i; }
|
||||
};
|
||||
template <class IntegerType>
|
||||
struct counting_iterator_traits {
|
||||
typedef IntegerType value_type;
|
||||
typedef IntegerType reference;
|
||||
typedef const IntegerType& reference;
|
||||
typedef value_type* pointer;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <boost/iterator.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/compressed_pair.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
|
||||
// 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
|
||||
@ -32,86 +31,6 @@ namespace boost {
|
||||
template <class T>
|
||||
struct type {};
|
||||
|
||||
|
||||
//============================================================================
|
||||
// Concept checking classes that express the requirements for iterator
|
||||
// policies and adapted types. These classes are mostly for
|
||||
// documentation purposes, and are not used in this header file. They
|
||||
// merely provide a more succinct statement of what is expected of the
|
||||
// iterator policies.
|
||||
|
||||
template <class Policies, class Adapted, class Traits>
|
||||
struct TrivialIteratorPoliciesConcept
|
||||
{
|
||||
typedef typename Traits::reference Reference;
|
||||
void constraints() {
|
||||
function_requires< AssignableConcept<Policies> >();
|
||||
function_requires< DefaultConstructibleConcept<Policies> >();
|
||||
function_requires< AssignableConcept<Adapted> >();
|
||||
function_requires< DefaultConstructibleConcept<Adapted> >();
|
||||
|
||||
const_constraints();
|
||||
}
|
||||
void const_constraints() const {
|
||||
Reference r = p.dereference(type<Reference>(), x);
|
||||
b = p.equal(x, x);
|
||||
}
|
||||
Policies p;
|
||||
Adapted x;
|
||||
mutable bool b;
|
||||
};
|
||||
|
||||
template <class Policies, class Adapted, class Traits>
|
||||
struct ForwardIteratorPoliciesConcept
|
||||
{
|
||||
void constraints() {
|
||||
function_requires<
|
||||
TrivialIteratorPoliciesConcept<Policies, Adapted, Traits>
|
||||
>();
|
||||
|
||||
p.increment(x);
|
||||
}
|
||||
Policies p;
|
||||
Adapted x;
|
||||
};
|
||||
|
||||
template <class Policies, class Adapted, class Traits>
|
||||
struct BidirectionalIteratorPoliciesConcept
|
||||
{
|
||||
void constraints() {
|
||||
function_requires<
|
||||
ForwardIteratorPoliciesConcept<Policies, Adapted, Traits>
|
||||
>();
|
||||
|
||||
p.decrement(x);
|
||||
}
|
||||
Policies p;
|
||||
Adapted x;
|
||||
};
|
||||
|
||||
template <class Policies, class Adapted, class Traits>
|
||||
struct RandomAccessIteratorPoliciesConcept
|
||||
{
|
||||
typedef typename Traits::difference_type DifferenceType;
|
||||
void constraints() {
|
||||
function_requires<
|
||||
BidirectionalIteratorPoliciesConcept<Policies, Adapted, Traits>
|
||||
>();
|
||||
|
||||
p.advance(x, n);
|
||||
const_constraints();
|
||||
}
|
||||
void const_constraints() const {
|
||||
n = p.distance(type<DifferenceType>(), x, x);
|
||||
b = p.less(x, x);
|
||||
}
|
||||
Policies p;
|
||||
Adapted x;
|
||||
mutable DifferenceType n;
|
||||
mutable bool b;
|
||||
};
|
||||
|
||||
|
||||
//============================================================================
|
||||
// Default policies for iterator adaptors. You can use this as a base
|
||||
// class if you want to customize particular policies.
|
||||
@ -280,7 +199,7 @@ public:
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
reference operator[](difference_type n) const
|
||||
reference operator[](difference_type n)
|
||||
{ return *(*this + n); }
|
||||
|
||||
Self& operator++() {
|
||||
|
@ -4,7 +4,6 @@
|
||||
// This is meant to be the beginnings of a comprehensive, generic
|
||||
// test suite for STL concepts such as iterators and containers.
|
||||
|
||||
#include <iterator>
|
||||
#include <assert.h>
|
||||
|
||||
namespace boost {
|
||||
@ -23,7 +22,7 @@ struct dummyT {
|
||||
// TrivialIterator.
|
||||
// Preconditions: i != j, *i == val
|
||||
template <class Iterator, class T>
|
||||
void trivial_iterator_test(const Iterator i, const Iterator j, T val)
|
||||
void trivial_iterator_test(Iterator i, Iterator j, T val)
|
||||
{
|
||||
Iterator k;
|
||||
assert(i == i);
|
||||
@ -52,7 +51,7 @@ void trivial_iterator_test(const Iterator i, const Iterator j, T val)
|
||||
|
||||
// Preconditions: i != j
|
||||
template <class Iterator, class T>
|
||||
void mutable_trivial_iterator_test(const Iterator i, const Iterator j, T val)
|
||||
void mutable_trivial_iterator_test(Iterator i, Iterator j, T val)
|
||||
{
|
||||
*i = val;
|
||||
trivial_iterator_test(i, j, val);
|
||||
@ -121,7 +120,7 @@ template <class Iterator, class TrueVals>
|
||||
void random_access_iterator_test(Iterator i, int N, TrueVals vals)
|
||||
{
|
||||
bidirectional_iterator_test(i, vals[0], vals[1]);
|
||||
const Iterator j = i;
|
||||
Iterator j = i;
|
||||
int c;
|
||||
|
||||
for (c = 0; c < N-1; ++c) {
|
||||
|
Reference in New Issue
Block a user