• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
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">
11</head>
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>
20</tr></table>
21<hr>
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>
24</div>
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>
30</div>
31<div class="refsect1">
32<a name="idm45301721907648"></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
40  incrementable).</p>
41</div>
42<div class="refsect1">
43<a name="idm45301721905872"></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>
47</ul></div>
48</div>
49<div class="refsect1">
50<a name="idm45301721903856"></a><h2>Associated types</h2>
51<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
52<li class="listitem">
53<p><span class="bold"><strong>value_type</strong></span></p>
54<pre class="literallayout">std::iterator_traits&lt;Iter&gt;::value_type</pre>
55<p>The value type of the iterator</p>
56</li>
57<li class="listitem">
58<p><span class="bold"><strong>category</strong></span></p>
59<pre class="literallayout">std::iterator_traits&lt;Iter&gt;::iterator_category</pre>
60<p>The category of the iterator</p>
61</li>
62</ul></div>
63</div>
64<div class="refsect1">
65<a name="idm45301721899712"></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>
69<dt>
70<span class="term"><code class="varname">i</code>, </span><span class="term"><code class="varname">j</code></span>
71</dt>
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>
75</dl></div>
76</div>
77<div class="refsect1">
78<a name="idm45301721895632"></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>.
83                </p></dd>
84</dl></div>
85</div>
86<div class="refsect1">
87<a name="idm45301721893712"></a><h2>Valid expressions</h2>
88<div class="informaltable"><table class="table">
89<colgroup>
90<col>
91<col>
92<col>
93<col>
94<col>
95<col>
96</colgroup>
97<thead><tr>
98<th>Name</th>
99<th>Expression</th>
100<th>Type</th>
101<th>Precondition</th>
102<th>Semantics</th>
103<th>Postcondition</th>
104</tr></thead>
105<tbody>
106<tr>
107<td><p>Dereference</p></td>
108<td><p>*i</p></td>
109<td><p><span class="type">const-if-not-mutable value_type &amp;</span></p></td>
110<td><p><code class="computeroutput">i</code> is incrementable (not
111    off-the-end)</p></td>
112<td> </td>
113<td> </td>
114</tr>
115<tr>
116<td><p>Member access</p></td>
117<td><p>i-&gt;{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>
121<td> </td>
122<td> </td>
123</tr>
124<tr>
125<td><p>Preincrement</p></td>
126<td><p>++i</p></td>
127<td><p><span class="type">Iter &amp;</span></p></td>
128<td><p><code class="computeroutput">i</code> is incrementable (not
129    off-the-end)</p></td>
130<td> </td>
131<td> </td>
132</tr>
133<tr>
134<td><p>Postincrement</p></td>
135<td><p>i++</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
141    off-the-end</p></td>
142</tr>
143</tbody>
144</table></div>
145</div>
146<div class="refsect1">
147<a name="idm45301721879088"></a><h2>Complexity</h2>
148<p>
149  All iterator operations must take amortized constant time.
150  </p>
151</div>
152<div class="refsect1">
153<a name="idm45301721878368"></a><h2>Invariants</h2>
154<div class="variablelist"><dl class="variablelist">
155<dt><span class="term">Predecrement must return object</span></dt>
156<dd><p>
157  <code class="computeroutput">&amp;i = &amp;(++i)</code>
158  </p></dd>
159<dt><span class="term">Unique path through sequence</span></dt>
160<dd><p>
161  <code class="computeroutput">i == j</code> implies <code class="computeroutput">++i == ++j</code>
162  </p></dd>
163</dl></div>
164</div>
165<div class="refsect1">
166<a name="idm45301721874448"></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&lt;T&gt;::iterator</span></span></li>
170</ul></div>
171</div>
172<div class="refsect1">
173<a name="idm45301721872176"></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>
175</div>
176</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>)
182      </p>
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
190      317-274-5902.</p>
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:
195        </p>
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>
205</div></td>
206</tr></table>
207<hr>
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>
210</div>
211</body>
212</html>
213