From 4768b167ab39e78d999f2ba75e19b7e0c60f978f Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Fri, 14 Dec 2001 12:54:21 +0000 Subject: [PATCH] Removed obsolete mentions of "less"; Added formalized Policies Concept description [SVN r12056] --- iterator_adaptors.htm | 84 ++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 46 deletions(-) diff --git a/iterator_adaptors.htm b/iterator_adaptors.htm index 7db55cc..4620bbc 100644 --- a/iterator_adaptors.htm +++ b/iterator_adaptors.htm @@ -307,12 +307,16 @@ typedef iterator_adaptor<foo_iterator, foo_policies, - - - - - - - - -
- Core Iterator Operations
- T: adapted iterator type; p: object of type T; n: T::size_type; x: T::difference_type; p1, p2: iterators + Policies Class Requirements
+ T: adapted iterator type; x, y: objects of type + T; p: T::policies_type + d: + T::difference_type; i1, i2: + T::base_type
Operation + Expression Effects @@ -321,7 +325,7 @@ typedef iterator_adaptor<foo_iterator, foo_policies, Required for Iterator Categories
initialize + p.initialize(b) optionally modify base iterator during iterator construction @@ -333,79 +337,66 @@ typedef iterator_adaptor<foo_iterator, foo_policies, "http://www.sgi.com/tech/stl/ForwardIterator.html">Forward/ Bidirectional/ - Random - Access + Random Access
dereference + p.dereference(x) returns an element of the iterator's reference type - *p, p[n] + *x, x[d]
equal + p.equal(x, y) tests the iterator for equality - p1 == p2, p1 != p2 + i1 == i2, i1 != i2
increment + p.increment(x) increments the iterator ++p, p++
decrement + p.decrement(x) decrements the iterator - --p, p-- + --x, x-- Bidirectional/ - Random - Access + Random Access
less - - imposes a Strict Weak - Ordering relation on iterators - - - p1 < p2, - p1 <= p2, - p1 > p2, - p1 >= p2 - - Random - Access - -
distance + p.distance(x, y) measures the distance between iterators - p1 - p2 + y - x, x < y + + Random + Access
advance + p.advance(x, n) adds an integer offset to iterators -p + x, -x + p, -p += x, -p - x, -p -= x +x + d, +d + x, + +
+x += d, +x - d,
+x -= d
@@ -665,7 +656,7 @@ int main(int, char*[])
  • Interoperable iterators can be freely mixed in comparison expressions so long as the Policies class has equal (and, for - random access iterators, less) members that can accept both + random access iterators, distance) members that can accept both Base types in either order.
  • Interoperable iterators can be freely mixed in subtraction @@ -719,11 +710,12 @@ they share the same Policies and since Category and the projection const_iterator.
  • Since projection_iterator_policies implements only the -dereference operation, and inherits all other behaviors from default_iterator_policies, which has -fully-templatized equal, less, and distance -operations, the iterator and const_iterator can be freely -mixed in comparison and subtraction expressions. +dereference operation, and inherits all other behaviors from +default_iterator_policies, +which has fully-templatized equal and distance +operations, the iterator and const_iterator can be +freely mixed in comparison and subtraction expressions.