1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
4 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
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="idp14900640-bb.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">
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>
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="idp14900640-bb.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>
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>
32 <div class="refsect1">
33 <a name="idp634271104"></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
42 <div class="refsect1">
43 <a name="idp634272848"></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>
50 <div class="refsect1">
51 <a name="idp634276176"></a><h2>Associated types</h2>
52 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
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>
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>
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>
71 <div class="refsect1">
72 <a name="idp634283520"></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>
77 <span class="term"><code class="varname">i</code>, </span><span class="term"><code class="varname">j</code></span>
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>
84 <div class="refsect1">
85 <a name="idp634288016"></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>.
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>.
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>.
101 <div class="refsect1">
102 <a name="idp634295824"></a><h2>Valid expressions</h2>
103 <div class="informaltable"><table class="table">
116 <th>Precondition</th>
118 <th>Postcondition</th>
122 <td><p>Dereference</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>
131 <td><p>Preincrement</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>
140 <td><p>Postincrement</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
150 <td><p>Postincrement and dereference</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
162 <div class="refsect1">
163 <a name="idp634313152"></a><h2>Complexity</h2>
165 All iterator operations must take amortized constant time.
168 <div class="refsect1">
169 <a name="idp634313904"></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>
172 <div class="refsect1">
173 <a name="idp634315392"></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>
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>)
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
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:
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>
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="idp14900640-bb.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>