| 1 | <html> | 
|---|
| 2 | <head> | 
|---|
| 3 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | 
|---|
| 4 | <title>Concept InputIterator</title> | 
|---|
| 5 | <link rel="stylesheet" href="boostbook.css" type="text/css"> | 
|---|
| 6 | <meta name="generator" content="DocBook XSL Stylesheets V1.68.1"> | 
|---|
| 7 | <link rel="start" href="index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> | 
|---|
| 8 | <link rel="up" href="id620092-bb.html#concepts.reference" title="Concept reference"> | 
|---|
| 9 | <link rel="prev" href="Assignable.html" title="Concept Assignable"> | 
|---|
| 10 | <link rel="next" href="OutputIterator.html" title="Concept OutputIterator"> | 
|---|
| 11 | </head> | 
|---|
| 12 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> | 
|---|
| 13 | <table cellpadding="2" width="100%"> | 
|---|
| 14 | <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../boost.png"></td> | 
|---|
| 15 | <td align="center"><a href="../../index.htm">Home</a></td> | 
|---|
| 16 | <td align="center"><a href="../../libs/libraries.htm">Libraries</a></td> | 
|---|
| 17 | <td align="center"><a href="../../people/people.htm">People</a></td> | 
|---|
| 18 | <td align="center"><a href="../../more/faq.htm">FAQ</a></td> | 
|---|
| 19 | <td align="center"><a href="../../more/index.htm">More</a></td> | 
|---|
| 20 | </table> | 
|---|
| 21 | <hr> | 
|---|
| 22 | <div class="spirit-nav"> | 
|---|
| 23 | <a accesskey="p" href="Assignable.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="id620092-bb.html#concepts.reference"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="OutputIterator.html"><img src="images/next.png" alt="Next"></a> | 
|---|
| 24 | </div> | 
|---|
| 25 | <div class="refentry" lang="en"> | 
|---|
| 26 | <a name="InputIterator"></a><div class="titlepage"></div> | 
|---|
| 27 | <div class="refnamediv"> | 
|---|
| 28 | <h2><span class="refentrytitle">Concept InputIterator</span></h2> | 
|---|
| 29 | <p>InputIterator</p> | 
|---|
| 30 | </div> | 
|---|
| 31 | <div class="refsect1" lang="en"> | 
|---|
| 32 | <a name="id942539"></a><h2>Description</h2> | 
|---|
| 33 | <p>An input iterator is an iterator that can read through a sequence of | 
|---|
| 34 |   values.  It is single-pass (old values of the iterator cannot be | 
|---|
| 35 |   re-used), and read-only.</p> | 
|---|
| 36 | <p>An input iterator represents a position in a sequence.  Therefore, the | 
|---|
| 37 |   iterator can point into the sequence (returning a value when dereferenced | 
|---|
| 38 |   and being incrementable), or be off-the-end (and not dereferenceable or | 
|---|
| 39 |   incrementable).</p> | 
|---|
| 40 | </div> | 
|---|
| 41 | <div class="refsect1" lang="en"> | 
|---|
| 42 | <a name="id942557"></a><h2>Refinement of</h2> | 
|---|
| 43 | <div class="itemizedlist"><ul type="disc"> | 
|---|
| 44 | <li><p><a href="Assignable.html" title="Concept Assignable">Assignable</a></p></li> | 
|---|
| 45 | <li><p><a href="DefaultConstructible.html" title="Concept DefaultConstructible">DefaultConstructible</a></p></li> | 
|---|
| 46 | <li><p><a href="EqualityComparable.html" title="Concept EqualityComparable">EqualityComparable</a></p></li> | 
|---|
| 47 | </ul></div> | 
|---|
| 48 | </div> | 
|---|
| 49 | <div class="refsect1" lang="en"> | 
|---|
| 50 | <a name="id942586"></a><h2>Associated types</h2> | 
|---|
| 51 | <div class="itemizedlist"><ul type="disc"> | 
|---|
| 52 | <li> | 
|---|
| 53 | <p><span class="bold"><strong>value_type</strong></span></p> | 
|---|
| 54 | <pre class="literallayout">std::iterator_traits<Iter>::value_type</pre> | 
|---|
| 55 | <p>The value type of the iterator (not necessarily what | 
|---|
| 56 |     <code class="computeroutput">*i</code> returns)</p> | 
|---|
| 57 | </li> | 
|---|
| 58 | <li> | 
|---|
| 59 | <p><span class="bold"><strong>difference_type</strong></span></p> | 
|---|
| 60 | <pre class="literallayout">std::iterator_traits<Iter>::difference_type</pre> | 
|---|
| 61 | <p>The difference type of the iterator</p> | 
|---|
| 62 | </li> | 
|---|
| 63 | <li> | 
|---|
| 64 | <p><span class="bold"><strong>category</strong></span></p> | 
|---|
| 65 | <pre class="literallayout">std::iterator_traits<Iter>::iterator_category</pre> | 
|---|
| 66 | <p>The category of the iterator</p> | 
|---|
| 67 | </li> | 
|---|
| 68 | </ul></div> | 
|---|
| 69 | </div> | 
|---|
| 70 | <div class="refsect1" lang="en"> | 
|---|
| 71 | <a name="id942649"></a><h2>Notation</h2> | 
|---|
| 72 | <div class="variablelist"><dl> | 
|---|
| 73 | <dt><span class="term">Iter</span></dt> | 
|---|
| 74 | <dd>A type playing the role of iterator-type in the <a href="InputIterator.html" title="Concept InputIterator">InputIterator</a> concept.</dd> | 
|---|
| 75 | <dt> | 
|---|
| 76 | <span class="term"><code class="varname">i</code>, </span><span class="term"><code class="varname">j</code></span> | 
|---|
| 77 | </dt> | 
|---|
| 78 | <dd>Objects of type Iter</dd> | 
|---|
| 79 | <dt><span class="term"><code class="varname">x</code></span></dt> | 
|---|
| 80 | <dd>Object of type value_type</dd> | 
|---|
| 81 | </dl></div> | 
|---|
| 82 | </div> | 
|---|
| 83 | <div class="refsect1" lang="en"> | 
|---|
| 84 | <a name="id942687"></a><h2>Type expressions</h2> | 
|---|
| 85 | <div class="variablelist"><dl> | 
|---|
| 86 | <dt><span class="term">Category tag</span></dt> | 
|---|
| 87 | <dd><p><span class="type">category</span> must be  | 
|---|
| 88 |                   derived from <span class="type">std::input_iterator_tag</span>,  a model  of <a href="DefaultConstructible.html" title="Concept DefaultConstructible">DefaultConstructible</a>,  and  a model  of <a href="CopyConstructible.html" title="Concept CopyConstructible">CopyConstructible</a>. | 
|---|
| 89 |                 </p></dd> | 
|---|
| 90 | <dt><span class="term">Value type copy constructibility</span></dt> | 
|---|
| 91 | <dd><p><span class="type">value_type</span> must be  | 
|---|
| 92 |                    a model  of <a href="CopyConstructible.html" title="Concept CopyConstructible">CopyConstructible</a>. | 
|---|
| 93 |                 </p></dd> | 
|---|
| 94 | <dt><span class="term">Difference type properties</span></dt> | 
|---|
| 95 | <dd><p><span class="type">difference_type</span> must be  | 
|---|
| 96 |                    a model  of <a href="SignedInteger.html" title="Concept SignedInteger">SignedInteger</a>. | 
|---|
| 97 |                 </p></dd> | 
|---|
| 98 | </dl></div> | 
|---|
| 99 | </div> | 
|---|
| 100 | <div class="refsect1" lang="en"> | 
|---|
| 101 | <a name="id942757"></a><h2>Valid expressions</h2> | 
|---|
| 102 | <div class="informaltable"><table class="table"> | 
|---|
| 103 | <colgroup> | 
|---|
| 104 | <col> | 
|---|
| 105 | <col> | 
|---|
| 106 | <col> | 
|---|
| 107 | <col> | 
|---|
| 108 | <col> | 
|---|
| 109 | <col> | 
|---|
| 110 | </colgroup> | 
|---|
| 111 | <thead><tr> | 
|---|
| 112 | <th>Name</th> | 
|---|
| 113 | <th>Expression</th> | 
|---|
| 114 | <th>Type</th> | 
|---|
| 115 | <th>Precondition</th> | 
|---|
| 116 | <th>Semantics</th> | 
|---|
| 117 | <th>Postcondition</th> | 
|---|
| 118 | </tr></thead> | 
|---|
| 119 | <tbody> | 
|---|
| 120 | <tr> | 
|---|
| 121 | <td><p>Dereference</p></td> | 
|---|
| 122 | <td><p>*i</p></td> | 
|---|
| 123 | <td><p>Convertible to <span class="type">value_type</span></p></td> | 
|---|
| 124 | <td><p><code class="computeroutput">i</code> is incrementable (not | 
|---|
| 125 |     off-the-end)</p></td> | 
|---|
| 126 | <td> </td> | 
|---|
| 127 | <td> </td> | 
|---|
| 128 | </tr> | 
|---|
| 129 | <tr> | 
|---|
| 130 | <td><p>Preincrement</p></td> | 
|---|
| 131 | <td><p>++i</p></td> | 
|---|
| 132 | <td><p><span class="type">Iter &</span></p></td> | 
|---|
| 133 | <td><p><code class="computeroutput">i</code> is incrementable (not | 
|---|
| 134 |     off-the-end)</p></td> | 
|---|
| 135 | <td> </td> | 
|---|
| 136 | <td> </td> | 
|---|
| 137 | </tr> | 
|---|
| 138 | <tr> | 
|---|
| 139 | <td><p>Postincrement</p></td> | 
|---|
| 140 | <td><p>i++</p></td> | 
|---|
| 141 | <td><p></p></td> | 
|---|
| 142 | <td><p><code class="computeroutput">i</code> is incrementable (not | 
|---|
| 143 |     off-the-end)</p></td> | 
|---|
| 144 | <td><p>Equivalent to <code class="computeroutput">(void)(++i)</code></p></td> | 
|---|
| 145 | <td><p><code class="computeroutput">i</code> is dereferenceable or | 
|---|
| 146 |     off-the-end</p></td> | 
|---|
| 147 | </tr> | 
|---|
| 148 | <tr> | 
|---|
| 149 | <td><p>Postincrement and dereference</p></td> | 
|---|
| 150 | <td><p>*i++</p></td> | 
|---|
| 151 | <td><p>Convertible to <span class="type">value_type</span></p></td> | 
|---|
| 152 | <td><p><code class="computeroutput">i</code> is incrementable (not | 
|---|
| 153 |     off-the-end)</p></td> | 
|---|
| 154 | <td><p>Equivalent to <code class="computeroutput">{value_type t = *i; ++i; return t;}</code></p></td> | 
|---|
| 155 | <td><p><code class="computeroutput">i</code> is dereferenceable or | 
|---|
| 156 |     off-the-end</p></td> | 
|---|
| 157 | </tr> | 
|---|
| 158 | </tbody> | 
|---|
| 159 | </table></div> | 
|---|
| 160 | </div> | 
|---|
| 161 | <div class="refsect1" lang="en"> | 
|---|
| 162 | <a name="id942903"></a><h2>Complexity</h2> | 
|---|
| 163 | <p> | 
|---|
| 164 |   All iterator operations must take amortized constant time. | 
|---|
| 165 |   </p> | 
|---|
| 166 | </div> | 
|---|
| 167 | <div class="refsect1" lang="en"> | 
|---|
| 168 | <a name="id942910"></a><h2>Models</h2> | 
|---|
| 169 | <div class="itemizedlist"><ul type="disc"><li><span class="simplelist"><span class="type">std::istream_iterator</span></span></li></ul></div> | 
|---|
| 170 | </div> | 
|---|
| 171 | <div class="refsect1" lang="en"> | 
|---|
| 172 | <a name="id942922"></a><h2>See also</h2> | 
|---|
| 173 | <div class="itemizedlist"><ul type="disc"> | 
|---|
| 174 | <li><p><a href="DefaultConstructible.html" title="Concept DefaultConstructible">DefaultConstructible</a></p></li> | 
|---|
| 175 | <li><p><a href="EqualityComparable.html" title="Concept EqualityComparable">EqualityComparable</a></p></li> | 
|---|
| 176 | <li><p><a href="ForwardIterator.html" title="Concept ForwardIterator">ForwardIterator</a></p></li> | 
|---|
| 177 | <li><p><a href="OutputIterator.html" title="Concept OutputIterator">OutputIterator</a></p></li> | 
|---|
| 178 | </ul></div> | 
|---|
| 179 | </div> | 
|---|
| 180 | </div> | 
|---|
| 181 | <table width="100%"><tr> | 
|---|
| 182 | <td align="left"></td> | 
|---|
| 183 | <td align="right"><small>Copyright © 2001, 2002 Indiana University<br>Copyright © 2000, 2001 University of Notre Dame du Lac<br>Copyright © 2000 Jeremy Siek, Lie-Quan Lee, Andrew Lumsdaine<br>Copyright © 1996-1999 Silicon Graphics Computer Systems, Inc.<br>Copyright © 1994 Hewlett-Packard Company</small></td> | 
|---|
| 184 | </tr></table> | 
|---|
| 185 | <hr> | 
|---|
| 186 | <div class="spirit-nav"> | 
|---|
| 187 | <a accesskey="p" href="Assignable.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="id620092-bb.html#concepts.reference"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="OutputIterator.html"><img src="images/next.png" alt="Next"></a> | 
|---|
| 188 | </div> | 
|---|
| 189 | </body> | 
|---|
| 190 | </html> | 
|---|