From 78886ab383fb3c5ef3cba53c3be48ed9f78aed9e Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Tue, 20 Feb 2001 03:49:26 +0000 Subject: [PATCH] Added cross-reference; improved policies documentation [SVN r9286] --- iterator_adaptors.htm | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/iterator_adaptors.htm b/iterator_adaptors.htm index 0bc8ffb..7cfb439 100644 --- a/iterator_adaptors.htm +++ b/iterator_adaptors.htm @@ -210,11 +210,14 @@ struct iterator_adaptor; "http://www.sgi.com/tech/stl/RandomAccessIterator.html">Random Access Iterator. Your Policies class must implement three, four, or seven of the core iterator operations below depending on the iterator - categories you want it to support. + categories you want it to support.
+
+ @@ -222,12 +225,16 @@ struct iterator_adaptor;
- Core Iterator Operations + Core Iterator Operations
+ T: iterator type; p: object of type T; n: T::size_type; x: T::difference_type; p1, p2: iterators
Effects + Implements Operations + Required for Iterator Categories
dereference returns an element of the iterator's reference type + + *p, p[n] Input/ tests the iterator for equality + p1 == p2, p1 != p2 +
increment increments the iterator + ++p, p++ +
decrement decrements the iterator + --p, p-- + Bidirectional/ Random @@ -263,7 +276,13 @@ struct iterator_adaptor; imposes a Strict Weak - Ordering relation on the iterator's reference type + Ordering relation on iterators + + + p1 < p2, + p1 <= p2, + p1 > p2, + p1 >= p2 Random @@ -274,10 +293,20 @@ struct iterator_adaptor; measures the distance between iterators + p1 - p2 +
advance adds an integer offset to iterators + + +p + x, +x + p, +p += x, +p - x, +p -= x +

The library also supplies a "trivial" policy class, @@ -516,8 +545,11 @@ int main(int, char*[])

  • const and non-const pointers to T can be freely subtracted, in any order. - Getting user-defined iterators to work together that way is nontrivial, but - iterator_adaptor can make it easy. The rules are as follows: + + Getting user-defined iterators to work together that way is nontrivial (see + here for an example of where + the C++ standard got it wrong), but iterator_adaptor can make it + easy. The rules are as follows: