1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5<title>Concept InputIterator</title> 6<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css"> 7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 8<link rel="home" href="index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> 9<link rel="up" href="concept_check.html#concepts.reference" title="Concept reference"> 10<link rel="prev" href="Assignable.html" title="Concept Assignable"> 11<link rel="next" href="OutputIterator.html" title="Concept OutputIterator"> 12</head> 13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 14<table cellpadding="2" width="100%"><tr> 15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../boost.png"></td> 16<td align="center"><a href="../../index.html">Home</a></td> 17<td align="center"><a href="../../libs/libraries.htm">Libraries</a></td> 18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 20<td align="center"><a href="../../more/index.htm">More</a></td> 21</tr></table> 22<hr> 23<div class="spirit-nav"> 24<a accesskey="p" href="Assignable.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="concept_check.html#concepts.reference"><img src="../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="OutputIterator.html"><img src="../../doc/src/images/next.png" alt="Next"></a> 25</div> 26<div class="refentry"> 27<a name="InputIterator"></a><div class="titlepage"></div> 28<div class="refnamediv"> 29<h2><span class="refentrytitle">Concept InputIterator</span></h2> 30<p>InputIterator</p> 31</div> 32<div class="refsect1"> 33<a name="id-1.3.49.3.5.3"></a><h2>Description</h2> 34<p>An input iterator is an iterator that can read through a sequence of 35 values. It is single-pass (old values of the iterator cannot be 36 re-used), and read-only.</p> 37<p>An input iterator represents a position in a sequence. Therefore, the 38 iterator can point into the sequence (returning a value when dereferenced 39 and being incrementable), or be off-the-end (and not dereferenceable or 40 incrementable).</p> 41</div> 42<div class="refsect1"> 43<a name="id-1.3.49.3.5.4"></a><h2>Refinement of</h2> 44<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 45<li class="listitem"><p><a class="link" href="Assignable.html" title="Concept Assignable">Assignable</a></p></li> 46<li class="listitem"><p><a class="link" href="DefaultConstructible.html" title="Concept DefaultConstructible">DefaultConstructible</a></p></li> 47<li class="listitem"><p><a class="link" href="EqualityComparable.html" title="Concept EqualityComparable">EqualityComparable</a></p></li> 48</ul></div> 49</div> 50<div class="refsect1"> 51<a name="id-1.3.49.3.5.5"></a><h2>Associated types</h2> 52<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 53<li class="listitem"> 54<p><span class="bold"><strong>value_type</strong></span></p> 55<pre class="literallayout">std::iterator_traits<Iter>::value_type</pre> 56<p>The value type of the iterator (not necessarily what 57 <code class="computeroutput">*i</code> returns)</p> 58</li> 59<li class="listitem"> 60<p><span class="bold"><strong>difference_type</strong></span></p> 61<pre class="literallayout">std::iterator_traits<Iter>::difference_type</pre> 62<p>The difference type of the iterator</p> 63</li> 64<li class="listitem"> 65<p><span class="bold"><strong>category</strong></span></p> 66<pre class="literallayout">std::iterator_traits<Iter>::iterator_category</pre> 67<p>The category of the iterator</p> 68</li> 69</ul></div> 70</div> 71<div class="refsect1"> 72<a name="id-1.3.49.3.5.6"></a><h2>Notation</h2> 73<div class="variablelist"><dl class="variablelist"> 74<dt><span class="term">Iter</span></dt> 75<dd>A type playing the role of iterator-type in the <a class="link" href="InputIterator.html" title="Concept InputIterator">InputIterator</a> concept.</dd> 76<dt> 77<span class="term"><code class="varname">i</code>, </span><span class="term"><code class="varname">j</code></span> 78</dt> 79<dd>Objects of type Iter</dd> 80<dt><span class="term"><code class="varname">x</code></span></dt> 81<dd>Object of type value_type</dd> 82</dl></div> 83</div> 84<div class="refsect1"> 85<a name="id-1.3.49.3.5.7"></a><h2>Type expressions</h2> 86<div class="variablelist"><dl class="variablelist"> 87<dt><span class="term">Category tag</span></dt> 88<dd><p><span class="type">category</span> must be 89 derived from <span class="type">std::input_iterator_tag</span>, a model of <a class="link" href="DefaultConstructible.html" title="Concept DefaultConstructible">DefaultConstructible</a>, and a model of <a class="link" href="CopyConstructible.html" title="Concept CopyConstructible">CopyConstructible</a>. 90 </p></dd> 91<dt><span class="term">Value type copy constructibility</span></dt> 92<dd><p><span class="type">value_type</span> must be 93 a model of <a class="link" href="CopyConstructible.html" title="Concept CopyConstructible">CopyConstructible</a>. 94 </p></dd> 95<dt><span class="term">Difference type properties</span></dt> 96<dd><p><span class="type">difference_type</span> must be 97 a model of <a class="link" href="SignedInteger.html" title="Concept SignedInteger">SignedInteger</a>. 98 </p></dd> 99</dl></div> 100</div> 101<div class="refsect1"> 102<a name="id-1.3.49.3.5.8"></a><h2>Valid expressions</h2> 103<div class="informaltable"><table class="table"> 104<colgroup> 105<col> 106<col> 107<col> 108<col> 109<col> 110<col> 111</colgroup> 112<thead><tr> 113<th>Name</th> 114<th>Expression</th> 115<th>Type</th> 116<th>Precondition</th> 117<th>Semantics</th> 118<th>Postcondition</th> 119</tr></thead> 120<tbody> 121<tr> 122<td><p>Dereference</p></td> 123<td><p>*i</p></td> 124<td><p>Convertible to <span class="type">value_type</span></p></td> 125<td><p><code class="computeroutput">i</code> is incrementable (not 126 off-the-end)</p></td> 127<td> </td> 128<td> </td> 129</tr> 130<tr> 131<td><p>Preincrement</p></td> 132<td><p>++i</p></td> 133<td><p><span class="type">Iter &</span></p></td> 134<td><p><code class="computeroutput">i</code> is incrementable (not 135 off-the-end)</p></td> 136<td> </td> 137<td> </td> 138</tr> 139<tr> 140<td><p>Postincrement</p></td> 141<td><p>i++</p></td> 142<td><p></p></td> 143<td><p><code class="computeroutput">i</code> is incrementable (not 144 off-the-end)</p></td> 145<td><p>Equivalent to <code class="computeroutput">(void)(++i)</code></p></td> 146<td><p><code class="computeroutput">i</code> is dereferenceable or 147 off-the-end</p></td> 148</tr> 149<tr> 150<td><p>Postincrement and dereference</p></td> 151<td><p>*i++</p></td> 152<td><p>Convertible to <span class="type">value_type</span></p></td> 153<td><p><code class="computeroutput">i</code> is incrementable (not 154 off-the-end)</p></td> 155<td><p>Equivalent to <code class="computeroutput">{value_type t = *i; ++i; return t;}</code></p></td> 156<td><p><code class="computeroutput">i</code> is dereferenceable or 157 off-the-end</p></td> 158</tr> 159</tbody> 160</table></div> 161</div> 162<div class="refsect1"> 163<a name="id-1.3.49.3.5.9"></a><h2>Complexity</h2> 164<p> 165 All iterator operations must take amortized constant time. 166 </p> 167</div> 168<div class="refsect1"> 169<a name="id-1.3.49.3.5.10"></a><h2>Models</h2> 170<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="simplelist"><span class="type">std::istream_iterator</span></span></li></ul></div> 171</div> 172<div class="refsect1"> 173<a name="id-1.3.49.3.5.11"></a><h2>See also</h2> 174<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 175<li class="listitem"><p><a class="link" href="DefaultConstructible.html" title="Concept DefaultConstructible">DefaultConstructible</a></p></li> 176<li class="listitem"><p><a class="link" href="EqualityComparable.html" title="Concept EqualityComparable">EqualityComparable</a></p></li> 177</ul></div> 178</div> 179</div> 180<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 181<td align="left"></td> 182<td align="right"><div class="copyright-footer">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<p>Distributed under the Boost Software License, Version 1.0. 183 (See accompanying file <code class="filename">LICENSE_1_0.txt</code> or copy at 184 <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 185 </p> 186<p>This product includes software developed at the University 187 of Notre Dame and the Pervasive Technology Labs at Indiana 188 University. For technical information contact Andrew Lumsdaine 189 at the Pervasive Technology Labs at Indiana University. For 190 administrative and license questions contact the Advanced 191 Research and Technology Institute at 351 West 10th Street. 192 Indianapolis, Indiana 46202, phone 317-278-4100, fax 193 317-274-5902.</p> 194<p>Some concepts based on versions from the MTL draft manual 195 and Boost Graph and Property Map documentation, the SGI Standard 196 Template Library documentation and the Hewlett-Packard STL, 197 under the following license: 198 </p> 199<div class="blockquote"><blockquote class="blockquote"><p>Permission to use, copy, modify, distribute and 200 sell this software and its documentation for any purpose is 201 hereby granted without fee, provided that the above copyright 202 notice appears in all copies and that both that copyright 203 notice and this permission notice appear in supporting 204 documentation. Silicon Graphics makes no representations 205 about the suitability of this software for any purpose. It is 206 provided "as is" without express or implied 207 warranty.</p></blockquote></div> 208</div></td> 209</tr></table> 210<hr> 211<div class="spirit-nav"> 212<a accesskey="p" href="Assignable.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="concept_check.html#concepts.reference"><img src="../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="OutputIterator.html"><img src="../../doc/src/images/next.png" alt="Next"></a> 213</div> 214</body> 215</html> 216