diff --git a/MultiPassInputIterator.html b/MultiPassInputIterator.html new file mode 100644 index 0000000..ec6da14 --- /dev/null +++ b/MultiPassInputIterator.html @@ -0,0 +1,92 @@ + + + +MultiPassInputIterator + +C++ Boost + +
+ +

+ +MultiPassInputIterator +

+ +This concept is a refinement of InputIterator, +adding the requirements that the iterator can be used to make multiple +passes through a range, and that if it1 == it2 and +it1 is dereferenceable then ++it1 == ++it2. The +MultiPassInputIterator is very similar to the ForwardIterator. The +only difference is that a ForwardIterator +requires the reference type to be value_type&, whereas +MultiPassInputIterator is like InputIterator +in that the reference type merely has to be convertible to +value_type. + + +

Design Notes

+ +comments by Valentin Bonnard: + +

I think that introducing MultiPassInputIterator isn't the right +solution. Do you also want to define MultiPassBidirectionnalIterator +and MultiPassRandomAccessIterator ? I don't, definitly. It only +confuses the issue. The problem lies into the existing hierarchy of +iterators, which mixes movabillity, modifiabillity and lvalue-ness, +and these are clearly independant. + +

The terms Forward, Bidirectionnal and RandomAccess are about +movabillity and shouldn't be used to mean anything else. In a +completly orthogonal way, iterators can be immutable, mutable, or +neither. Lvalueness of iterators is also orthogonal with +immutabillity. With these clean concepts, your MultiPassInputIterator +is just called a ForwardIterator. + +

+Other translations are:
+std::ForwardIterator -> ForwardIterator & LvalueIterator
+std::BidirectionnalIterator -> BidirectionnalIterator & LvalueIterator
+std::RandomAccessIterator -> RandomAccessIterator & LvalueIterator
+ +

+Note that in practice the only operation not allowed on my +ForwardIterator which is allowed on std::ForwardIterator is +&*it. I think that &* is rarely needed in generic code. + +

+reply by Jeremy Siek: + +

+The above analysis by Valentin is right on. Of course, there is +the problem with backward compatibility. The current STL implementations +are based on the old definition of ForwardIterator. The right course +of action is to get ForwardIterator, etc. changed in the C++ standard. +Once that is done we can drop MultiPassInputIterator. + + +
+


+ + +
Copyright © 2000 +Jeremy Siek, Univ.of Notre Dame (jsiek@lsc.nd.edu) +
+ + +