From c21f6d1cbfcb27acb633825d0bf7d1bb834d6995 Mon Sep 17 00:00:00 2001 From: Jeremy Siek Date: Sat, 17 Feb 2001 19:59:19 +0000 Subject: [PATCH] added Category parameter and made a few more edits with regards to type requirements [SVN r9239] --- indirect_iterator.htm | 90 +++++++++++++++++++++++++++++++------------ 1 file changed, 65 insertions(+), 25 deletions(-) diff --git a/indirect_iterator.htm b/indirect_iterator.htm index 1b42cd0..f6f0169 100644 --- a/indirect_iterator.htm +++ b/indirect_iterator.htm @@ -42,12 +42,12 @@ reference indirect_iterator::operator*() const {
 namespace boost {
   template <class BaseIterator,
-            class Value, class Reference, class Pointer>
+            class Value, class Reference, class Pointer, class Category>
   struct indirect_iterator_generator;
   
   template <class BaseIterator,
       class Value, class Pointer, class Reference, 
-            class ConstPointer, class ConstReference>
+            class ConstPointer, class ConstReference, class Category>b
   struct indirect_iterator_pair_generator;
 
   template <class BaseIterator>
@@ -127,10 +127,9 @@ int main(int, char*[])
         BaseIterator 
 
         The iterator type being wrapped. The value_type
-        of the base iterator should itself be dereferenceable. 
-        Also, if the default Value template
-	parameter is used, the value_type must provide
-        a specialization of iterator_traits.
+        of the base iterator should itself be dereferenceable.  
+        The return type of the operator* for the
+        value_type should match the Reference type.
 
       
         Value 
@@ -138,7 +137,10 @@ int main(int, char*[])
         The value_type of the resulting iterator, unless const. If
         Value is const X, a conforming compiler makes the
         value_type non-const X[1].
+ "iterator_adaptors.htm#1">[1]. Note that if the default + is used for Value, then there must be a valid specialization + of iterator_traits for the value type of the base iterator. +
Default: std::iterator_traits<
  std::iterator_traits<BaseIterator>::value_type >::value_type
[2] @@ -156,17 +158,24 @@ int main(int, char*[]) The pointer type of the resulting iterator, and in particular, the result type of operator->().
Default: Value* + + + Category + The iterator_category type for the resulting iterator.
+ Default: + std::iterator_traits<BaseIterator>::iterator_category +

Concept Model

The indirect iterator will model whichever standard iterator concept - category is modeled by the base iterator. Thus, if the base iterator is - a model of Random Access - Iterator then so is the resulting indirect iterator. If the base - iterator models a more restrictive concept, the resulting indirect iterator - will model the same concept. + "http://www.sgi.com/tech/stl/Iterators.html">standard iterator + concept category is modeled by the base iterator. Thus, if the + base iterator is a model of Random + Access Iterator then so is the resulting indirect iterator. If + the base iterator models a more restrictive concept, the resulting + indirect iterator will model the same concept [3].

Members

The indirect iterator type implements the member functions and operators @@ -256,14 +265,20 @@ b,c,d,e,f,g,h, The iterator type being wrapped. The value_type of the base iterator should itself be dereferenceable. - Also, if the default Value template - parameter is used, the value_type must provide - a specialization of iterator_traits. + The return type of the operator* for the + value_type should match the Reference type. Value - The value_type of the resulting iterators
+ The value_type of the resulting iterators. + If Value is const X, a conforming compiler makes the + value_type non-const X[1]. Note that if the default + is used for Value, then there must be a valid + specialization of iterator_traits for the value type + of the base iterator.
+ Default: std::iterator_traits<
  std::iterator_traits<BaseIterator>::value_type >::value_type
[2] @@ -296,17 +311,26 @@ b,c,d,e,f,g,h, The pointer type of the resulting const_iterator, and in particular, the result type of its operator->().
Default: const Value* + + + Category + The iterator_category type for the resulting iterator.
+ Default: + std::iterator_traits<BaseIterator>::iterator_category

Concept Model

+ The indirect iterators will model whichever standard iterator concept - category is modeled by the base iterator. Thus, if the base iterator is - a model of Random Access - Iterator then so are the resulting indirect iterators. If the base - iterator models a more restrictive concept, the resulting indirect - iterators will model the same concept. + "http://www.sgi.com/tech/stl/Iterators.html">standard iterator + concept category is modeled by the base iterator. Thus, if the + base iterator is a model of Random + Access Iterator then so are the resulting indirect + iterators. If the base iterator models a more restrictive concept, + the resulting indirect iterators will model the same concept [3]. +

Members

The resulting iterator and const_iterator types implement @@ -379,6 +403,22 @@ a,b,c,d,e,f,g, Value and will need to specify this type explicitly.
+

[3]There is a caveat to which concept the + indirect iterator can model. If the return type of the + operator* for the base iterator's value type is not a + true reference, then strickly speaking, the indirect iterator can + not be a model of Forward + Iterator or any of the concepts that refine it. In this case + the Category for the indirect iterator should be + specified as std::input_iterator_tag. However, even in + this case, if the base iterator is a random access iterator, the + resulting indirect iterator will still satisfy most of the + requirements for Random + Access Iterator. + +

Revised 10 Feb 2001