3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Concept ForwardIterator</title>
5 <link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="index.html" title="Concept reference">
8 <link rel="up" href="index.html" title="Concept reference">
9 <link rel="prev" href="OutputIterator.html" title="Concept OutputIterator">
10 <link rel="next" href="BidirectionalIterator.html" title="Concept BidirectionalIterator">
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
15 <td align="center"><a href="../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../more/index.htm">More</a></td>
22 <div class="spirit-nav">
23 <a accesskey="p" href="OutputIterator.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><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="BidirectionalIterator.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
25 <div class="refentry">
26 <a name="ForwardIterator"></a><div class="titlepage"></div>
27 <div class="refnamediv">
28 <h2><span class="refentrytitle">Concept ForwardIterator</span></h2>
29 <p>ForwardIterator</p>
31 <div class="refsect1">
32 <a name="idm45853365460000"></a><h2>Description</h2>
33 <p>A forward iterator is an iterator that can read through a sequence of
34 values. It is multi-pass (old values of the iterator can be
35 re-used), and can be either mutable (data pointed to by it can be
36 changed) or not mutable.</p>
37 <p>An 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="idm45853365458224"></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="InputIterator.html" title="Concept InputIterator">InputIterator</a></p></li>
46 <li class="listitem"><p><a class="link" href="OutputIterator.html" title="Concept OutputIterator">OutputIterator</a></p></li>
49 <div class="refsect1">
50 <a name="idm45853365456208"></a><h2>Associated types</h2>
51 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
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</p>
58 <p><span class="bold"><strong>category</strong></span></p>
59 <pre class="literallayout">std::iterator_traits<Iter>::iterator_category</pre>
60 <p>The category of the iterator</p>
64 <div class="refsect1">
65 <a name="idm45853365452064"></a><h2>Notation</h2>
66 <div class="variablelist"><dl class="variablelist">
67 <dt><span class="term">Iter</span></dt>
68 <dd>A type playing the role of iterator-type in the <a class="link" href="ForwardIterator.html" title="Concept ForwardIterator">ForwardIterator</a> concept.</dd>
70 <span class="term"><code class="varname">i</code>, </span><span class="term"><code class="varname">j</code></span>
72 <dd>Objects of type Iter</dd>
73 <dt><span class="term"><code class="varname">x</code></span></dt>
74 <dd>Object of type value_type</dd>
77 <div class="refsect1">
78 <a name="idm45853365447984"></a><h2>Type expressions</h2>
79 <div class="variablelist"><dl class="variablelist">
80 <dt><span class="term">Category tag</span></dt>
81 <dd><p><span class="type">category</span> must be
82 derived from <span class="type">std::forward_iterator_tag</span>.
86 <div class="refsect1">
87 <a name="idm45853365446064"></a><h2>Valid expressions</h2>
88 <div class="informaltable"><table class="table">
101 <th>Precondition</th>
103 <th>Postcondition</th>
107 <td><p>Dereference</p></td>
109 <td><p><span class="type">const-if-not-mutable value_type &</span></p></td>
110 <td><p><code class="computeroutput">i</code> is incrementable (not
111 off-the-end)</p></td>
116 <td><p>Member access</p></td>
117 <td><p>i->{member-name} (return type is pointer-to-object type)</p></td>
118 <td><p><span class="type">const-if-not-mutable value_type *</span></p></td>
119 <td><p><code class="computeroutput">i</code> is incrementable (not
120 off-the-end)</p></td>
125 <td><p>Preincrement</p></td>
127 <td><p><span class="type">Iter &</span></p></td>
128 <td><p><code class="computeroutput">i</code> is incrementable (not
129 off-the-end)</p></td>
134 <td><p>Postincrement</p></td>
136 <td><p><span class="type">Iter</span></p></td>
137 <td><p><code class="computeroutput">i</code> is incrementable (not
138 off-the-end)</p></td>
139 <td><p>Equivalent to <code class="computeroutput">{Iter j = i; ++i; return j;}</code></p></td>
140 <td><p><code class="computeroutput">i</code> is dereferenceable or
146 <div class="refsect1">
147 <a name="idm45853365431440"></a><h2>Complexity</h2>
149 All iterator operations must take amortized constant time.
152 <div class="refsect1">
153 <a name="idm45853365430800"></a><h2>Invariants</h2>
154 <div class="variablelist"><dl class="variablelist">
155 <dt><span class="term">Predecrement must return object</span></dt>
157 <code class="computeroutput">&i = &(++i)</code>
159 <dt><span class="term">Unique path through sequence</span></dt>
161 <code class="computeroutput">i == j</code> implies <code class="computeroutput">++i == ++j</code>
165 <div class="refsect1">
166 <a name="idm45853365426880"></a><h2>Models</h2>
167 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
168 <li class="listitem"><span class="simplelist"><span class="type">T *</span></span></li>
169 <li class="listitem"><span class="simplelist"><span class="type">std::hash_set<T>::iterator</span></span></li>
172 <div class="refsect1">
173 <a name="idm45853365424608"></a><h2>See also</h2>
174 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><a class="link" href="BidirectionalIterator.html" title="Concept BidirectionalIterator">BidirectionalIterator</a></p></li></ul></div>
177 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
178 <td align="left"></td>
179 <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.
180 (See accompanying file <code class="filename">LICENSE_1_0.txt</code> or copy at
181 <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
183 <p>This product includes software developed at the University
184 of Notre Dame and the Pervasive Technology Labs at Indiana
185 University. For technical information contact Andrew Lumsdaine
186 at the Pervasive Technology Labs at Indiana University. For
187 administrative and license questions contact the Advanced
188 Research and Technology Institute at 351 West 10th Street.
189 Indianapolis, Indiana 46202, phone 317-278-4100, fax
191 <p>Some concepts based on versions from the MTL draft manual
192 and Boost Graph and Property Map documentation, the SGI Standard
193 Template Library documentation and the Hewlett-Packard STL,
194 under the following license:
196 <div class="blockquote"><blockquote class="blockquote"><p>Permission to use, copy, modify, distribute and
197 sell this software and its documentation for any purpose is
198 hereby granted without fee, provided that the above copyright
199 notice appears in all copies and that both that copyright
200 notice and this permission notice appear in supporting
201 documentation. Silicon Graphics makes no representations
202 about the suitability of this software for any purpose. It is
203 provided "as is" without express or implied
204 warranty.</p></blockquote></div>
208 <div class="spirit-nav">
209 <a accesskey="p" href="OutputIterator.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><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="BidirectionalIterator.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>