1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2 3<html> 4<head> 5 <meta http-equiv="Content-Language" content="en-us"> 6 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> 7 8 <title>MultiPassInputIterator</title> 9</head> 10 11<body bgcolor="#FFFFFF" link="#0000EE" text="#000000" vlink="#551A8B" alink= 12"#FF0000"> 13 <img src="../../boost.png" alt="C++ Boost" width="277" height= 14 "86"><br clear="none"> 15 16 <h2><a name="concept:MultiPassInputIterator" id= 17 "concept:MultiPassInputIterator"></a> Multi-Pass Input Iterator</h2> 18 19 <p>This concept is a refinement of <a href= 20 "http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>, adding 21 the requirements that the iterator can be used to make multiple passes 22 through a range, and that if <tt>it1 == it2</tt> and <tt>it1</tt> is 23 dereferenceable then <tt>++it1 == ++it2</tt>. The Multi-Pass Input Iterator 24 is very similar to the <a href= 25 "http://www.sgi.com/tech/stl/ForwardIterator.html">Forward Iterator</a>. 26 The only difference is that a <a href= 27 "http://www.sgi.com/tech/stl/ForwardIterator.html">Forward Iterator</a> 28 requires the <tt>reference</tt> type to be <tt>value_type&</tt>, 29 whereas MultiPassInputIterator is like <a href= 30 "http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> in that 31 the <tt>reference</tt> type merely has to be convertible to 32 <tt>value_type</tt>.</p> 33 34 <h3>Design Notes</h3> 35 36 <p>comments by Valentin Bonnard:</p> 37 38 <p>I think that introducing Multi-Pass Input Iterator isn't the right 39 solution. Do you also want to define Multi-Pass Bidirectionnal Iterator and 40 Multi-Pass Random Access Iterator ? I don't, definitly. It only confuses 41 the issue. The problem lies into the existing hierarchy of iterators, which 42 mixes movabillity, modifiabillity and lvalue-ness, and these are clearly 43 independant.</p> 44 45 <p>The terms Forward, Bidirectionnal and Random Access are about 46 movabillity and shouldn't be used to mean anything else. In a completly 47 orthogonal way, iterators can be immutable, mutable, or neither. Lvalueness 48 of iterators is also orthogonal with immutabillity. With these clean 49 concepts, your Multi-Pass Input Iterator is just called a Forward 50 Iterator.</p> 51 52 <p>Other translations are:<br> 53 std::Forward Iterator -> ForwardIterator & Lvalue Iterator<br> 54 std::Bidirectionnal Iterator -> Bidirectionnal Iterator & Lvalue 55 Iterator<br> 56 std::Random Access Iterator -> Random Access Iterator & Lvalue 57 Iterator<br></p> 58 59 <p>Note that in practice the only operation not allowed on my Forward 60 Iterator which is allowed on std::Forward Iterator is <tt>&*it</tt>. I 61 think that <tt>&*</tt> is rarely needed in generic code.</p> 62 63 <p>reply by Jeremy Siek:</p> 64 65 <p>The above analysis by Valentin is right on. Of course, there is the 66 problem with backward compatibility. The current STL implementations are 67 based on the old definition of Forward Iterator. The right course of action 68 is to get Forward Iterator, etc. changed in the C++ standard. Once that is 69 done we can drop Multi-Pass Input Iterator.<br></p> 70 <hr> 71 72 <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src= 73 "../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional" 74 height="31" width="88"></a></p> 75 76 <p>Revised 77 <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->05 78 December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38516" --></p> 79 80 <table summary=""> 81 <tr valign="top"> 82 <td nowrap><i>Copyright © 2000</i></td> 83 84 <td><i><a href="http://www.lsc.nd.edu/~jsiek">Jeremy Siek</a>, Univ.of 85 Notre Dame (<a href= 86 "mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</a>)</i></td> 87 </tr> 88 </table> 89 90 <p><i>Distributed under the Boost Software License, Version 1.0. (See 91 accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or 92 copy at <a href= 93 "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p> 94</body> 95</html> 96