• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 ForwardIterator</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="OutputIterator.html" title="Concept OutputIterator">
11<link rel="next" href="BidirectionalIterator.html" title="Concept BidirectionalIterator">
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="OutputIterator.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="BidirectionalIterator.html"><img src="../../doc/src/images/next.png" alt="Next"></a>
25</div>
26<div class="refentry">
27<a name="ForwardIterator"></a><div class="titlepage"></div>
28<div class="refnamediv">
29<h2><span class="refentrytitle">Concept ForwardIterator</span></h2>
30<p>ForwardIterator</p>
31</div>
32<div class="refsect1">
33<a name="id-1.3.49.3.7.3"></a><h2>Description</h2>
34<p>A forward iterator is an iterator that can read through a sequence of
35  values.  It is multi-pass (old values of the iterator can be
36  re-used), and can be either mutable (data pointed to by it can be
37  changed) or not mutable.</p>
38<p>An iterator represents a position in a sequence.  Therefore, the
39  iterator can point into the sequence (returning a value when dereferenced
40  and being incrementable), or be off-the-end (and not dereferenceable or
41  incrementable).</p>
42</div>
43<div class="refsect1">
44<a name="id-1.3.49.3.7.4"></a><h2>Refinement of</h2>
45<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
46<li class="listitem"><p><a class="link" href="InputIterator.html" title="Concept InputIterator">InputIterator</a></p></li>
47<li class="listitem"><p><a class="link" href="OutputIterator.html" title="Concept OutputIterator">OutputIterator</a></p></li>
48</ul></div>
49</div>
50<div class="refsect1">
51<a name="id-1.3.49.3.7.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&lt;Iter&gt;::value_type</pre>
56<p>The value type of the iterator</p>
57</li>
58<li class="listitem">
59<p><span class="bold"><strong>category</strong></span></p>
60<pre class="literallayout">std::iterator_traits&lt;Iter&gt;::iterator_category</pre>
61<p>The category of the iterator</p>
62</li>
63</ul></div>
64</div>
65<div class="refsect1">
66<a name="id-1.3.49.3.7.6"></a><h2>Notation</h2>
67<div class="variablelist"><dl class="variablelist">
68<dt><span class="term">Iter</span></dt>
69<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<dt>
71<span class="term"><code class="varname">i</code>, </span><span class="term"><code class="varname">j</code></span>
72</dt>
73<dd>Objects of type Iter</dd>
74<dt><span class="term"><code class="varname">x</code></span></dt>
75<dd>Object of type value_type</dd>
76</dl></div>
77</div>
78<div class="refsect1">
79<a name="id-1.3.49.3.7.7"></a><h2>Type expressions</h2>
80<div class="variablelist"><dl class="variablelist">
81<dt><span class="term">Category tag</span></dt>
82<dd><p><span class="type">category</span> must be
83                  derived from <span class="type">std::forward_iterator_tag</span>.
84                </p></dd>
85</dl></div>
86</div>
87<div class="refsect1">
88<a name="id-1.3.49.3.7.8"></a><h2>Valid expressions</h2>
89<div class="informaltable"><table class="table">
90<colgroup>
91<col>
92<col>
93<col>
94<col>
95<col>
96<col>
97</colgroup>
98<thead><tr>
99<th>Name</th>
100<th>Expression</th>
101<th>Type</th>
102<th>Precondition</th>
103<th>Semantics</th>
104<th>Postcondition</th>
105</tr></thead>
106<tbody>
107<tr>
108<td><p>Dereference</p></td>
109<td><p>*i</p></td>
110<td><p><span class="type">const-if-not-mutable value_type &amp;</span></p></td>
111<td><p><code class="computeroutput">i</code> is incrementable (not
112    off-the-end)</p></td>
113<td> </td>
114<td> </td>
115</tr>
116<tr>
117<td><p>Member access</p></td>
118<td><p>i-&gt;{member-name} (return type is pointer-to-object type)</p></td>
119<td><p><span class="type">const-if-not-mutable value_type *</span></p></td>
120<td><p><code class="computeroutput">i</code> is incrementable (not
121    off-the-end)</p></td>
122<td> </td>
123<td> </td>
124</tr>
125<tr>
126<td><p>Preincrement</p></td>
127<td><p>++i</p></td>
128<td><p><span class="type">Iter &amp;</span></p></td>
129<td><p><code class="computeroutput">i</code> is incrementable (not
130    off-the-end)</p></td>
131<td> </td>
132<td> </td>
133</tr>
134<tr>
135<td><p>Postincrement</p></td>
136<td><p>i++</p></td>
137<td><p><span class="type">Iter</span></p></td>
138<td><p><code class="computeroutput">i</code> is incrementable (not
139    off-the-end)</p></td>
140<td><p>Equivalent to <code class="computeroutput">{Iter j = i; ++i; return j;}</code></p></td>
141<td><p><code class="computeroutput">i</code> is dereferenceable or
142    off-the-end</p></td>
143</tr>
144</tbody>
145</table></div>
146</div>
147<div class="refsect1">
148<a name="id-1.3.49.3.7.9"></a><h2>Complexity</h2>
149<p>
150  All iterator operations must take amortized constant time.
151  </p>
152</div>
153<div class="refsect1">
154<a name="id-1.3.49.3.7.10"></a><h2>Invariants</h2>
155<div class="variablelist"><dl class="variablelist">
156<dt><span class="term">Predecrement must return object</span></dt>
157<dd><p>
158  <code class="computeroutput">&amp;i = &amp;(++i)</code>
159  </p></dd>
160<dt><span class="term">Unique path through sequence</span></dt>
161<dd><p>
162  <code class="computeroutput">i == j</code> implies <code class="computeroutput">++i == ++j</code>
163  </p></dd>
164</dl></div>
165</div>
166<div class="refsect1">
167<a name="id-1.3.49.3.7.11"></a><h2>Models</h2>
168<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
169<li class="listitem"><span class="simplelist"><span class="type">T *</span></span></li>
170<li class="listitem"><span class="simplelist"><span class="type">std::hash_set&lt;T&gt;::iterator</span></span></li>
171</ul></div>
172</div>
173</div>
174<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
175<td align="left"></td>
176<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.
177      (See accompanying file <code class="filename">LICENSE_1_0.txt</code> or copy at
178      <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
179      </p>
180<p>This product includes software developed at the University
181      of Notre Dame and the Pervasive Technology Labs at Indiana
182      University. For technical information contact Andrew Lumsdaine
183      at the Pervasive Technology Labs at Indiana University.  For
184      administrative and license questions contact the Advanced
185      Research and Technology Institute at 351 West 10th Street.
186      Indianapolis, Indiana 46202, phone 317-278-4100, fax
187      317-274-5902.</p>
188<p>Some concepts based on versions from the MTL draft manual
189      and Boost Graph and Property Map documentation, the SGI Standard
190      Template Library documentation and the Hewlett-Packard STL,
191      under the following license:
192        </p>
193<div class="blockquote"><blockquote class="blockquote"><p>Permission to use, copy, modify, distribute and
194        sell this software and its documentation for any purpose is
195        hereby granted without fee, provided that the above copyright
196        notice appears in all copies and that both that copyright
197        notice and this permission notice appear in supporting
198        documentation.  Silicon Graphics makes no representations
199        about the suitability of this software for any purpose.  It is
200        provided "as is" without express or implied
201        warranty.</p></blockquote></div>
202</div></td>
203</tr></table>
204<hr>
205<div class="spirit-nav">
206<a accesskey="p" href="OutputIterator.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="BidirectionalIterator.html"><img src="../../doc/src/images/next.png" alt="Next"></a>
207</div>
208</body>
209</html>
210