• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Single Pass Range</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="Chapter 1. Range 2.0">
8<link rel="up" href="../concepts.html" title="Range Concepts">
9<link rel="prev" href="overview.html" title="Overview">
10<link rel="next" href="forward_range.html" title="Forward Range">
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="overview.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.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="forward_range.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h3 class="title">
27<a name="range.concepts.single_pass_range"></a><a class="link" href="single_pass_range.html" title="Single Pass Range">Single Pass Range</a>
28</h3></div></div></div>
29<h5>
30<a name="range.concepts.single_pass_range.h0"></a>
31        <span class="phrase"><a name="range.concepts.single_pass_range.notation"></a></span><a class="link" href="single_pass_range.html#range.concepts.single_pass_range.notation">Notation</a>
32      </h5>
33<div class="informaltable"><table class="table">
34<colgroup>
35<col>
36<col>
37</colgroup>
38<thead><tr></tr></thead>
39<tbody>
40<tr>
41<td>
42                <p>
43                  <code class="computeroutput"><span class="identifier">X</span></code>
44                </p>
45              </td>
46<td>
47                <p>
48                  A type that is a model of <a class="link" href="single_pass_range.html" title="Single Pass Range">Single
49                  Pass Range</a>.
50                </p>
51              </td>
52</tr>
53<tr>
54<td>
55                <p>
56                  <code class="computeroutput"><span class="identifier">a</span></code>
57                </p>
58              </td>
59<td>
60                <p>
61                  Object of type X.
62                </p>
63              </td>
64</tr>
65</tbody>
66</table></div>
67<h5>
68<a name="range.concepts.single_pass_range.h1"></a>
69        <span class="phrase"><a name="range.concepts.single_pass_range.description"></a></span><a class="link" href="single_pass_range.html#range.concepts.single_pass_range.description">Description</a>
70      </h5>
71<p>
72        A range <code class="computeroutput"><span class="identifier">X</span></code> where <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_iterator</span><span class="special">&lt;</span><span class="identifier">X</span><span class="special">&gt;::</span><span class="identifier">type</span></code> is a model of <a href="../../../../../../libs/iterator/doc/new-iter-concepts.html#singls-pass-iterators-lib-single-pass-iterators" target="_top">Single
73        Pass Iterator</a>.
74      </p>
75<h5>
76<a name="range.concepts.single_pass_range.h2"></a>
77        <span class="phrase"><a name="range.concepts.single_pass_range.associated_types"></a></span><a class="link" href="single_pass_range.html#range.concepts.single_pass_range.associated_types">Associated
78        types</a>
79      </h5>
80<div class="informaltable"><table class="table">
81<colgroup>
82<col>
83<col>
84<col>
85</colgroup>
86<thead><tr></tr></thead>
87<tbody>
88<tr>
89<td>
90                <p>
91                  Iterator type
92                </p>
93              </td>
94<td>
95                <p>
96                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_iterator</span><span class="special">&lt;</span><span class="identifier">X</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
97                </p>
98              </td>
99<td>
100                <p>
101                  The type of iterator used to iterate through a Range's elements.
102                  The iterator's value type is expected to be the Range's value type.
103                  A conversion from the iterator type to the <code class="computeroutput"><span class="keyword">const</span></code>
104                  iterator type must exist.
105                </p>
106              </td>
107</tr>
108<tr>
109<td>
110                <p>
111                  Const iterator type
112                </p>
113              </td>
114<td>
115                <p>
116                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="identifier">X</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
117                </p>
118              </td>
119<td>
120                <p>
121                  A type of iterator that may be used to examine, but not to modify,
122                  a Range's elements.
123                </p>
124              </td>
125</tr>
126</tbody>
127</table></div>
128<h5>
129<a name="range.concepts.single_pass_range.h3"></a>
130        <span class="phrase"><a name="range.concepts.single_pass_range.valid_expressions"></a></span><a class="link" href="single_pass_range.html#range.concepts.single_pass_range.valid_expressions">Valid
131        expressions</a>
132      </h5>
133<p>
134        The following expressions must be valid.
135      </p>
136<div class="informaltable"><table class="table">
137<colgroup>
138<col>
139<col>
140<col>
141</colgroup>
142<thead><tr>
143<th>
144                <p>
145                  Name
146                </p>
147              </th>
148<th>
149                <p>
150                  Expression
151                </p>
152              </th>
153<th>
154                <p>
155                  Return type
156                </p>
157              </th>
158</tr></thead>
159<tbody>
160<tr>
161<td>
162                <p>
163                  Beginning of range
164                </p>
165              </td>
166<td>
167                <p>
168                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">begin</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code>
169                </p>
170              </td>
171<td>
172                <p>
173                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_iterator</span><span class="special">&lt;</span><span class="identifier">X</span><span class="special">&gt;::</span><span class="identifier">type</span></code> if <code class="computeroutput"><span class="identifier">a</span></code>
174                  is mutable, <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_iterator</span><span class="special">&lt;</span><span class="keyword">const</span>
175                  <span class="identifier">X</span><span class="special">&gt;::</span><span class="identifier">type</span></code> otherwise
176                </p>
177              </td>
178</tr>
179<tr>
180<td>
181                <p>
182                  End of range
183                </p>
184              </td>
185<td>
186                <p>
187                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">end</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code>
188                </p>
189              </td>
190<td>
191                <p>
192                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_iterator</span><span class="special">&lt;</span><span class="identifier">X</span><span class="special">&gt;::</span><span class="identifier">type</span></code> if <code class="computeroutput"><span class="identifier">a</span></code>
193                  is mutable, <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_iterator</span><span class="special">&lt;</span><span class="keyword">const</span>
194                  <span class="identifier">X</span><span class="special">&gt;::</span><span class="identifier">type</span></code> otherwise
195                </p>
196              </td>
197</tr>
198</tbody>
199</table></div>
200<h5>
201<a name="range.concepts.single_pass_range.h4"></a>
202        <span class="phrase"><a name="range.concepts.single_pass_range.expression_semantics"></a></span><a class="link" href="single_pass_range.html#range.concepts.single_pass_range.expression_semantics">Expression
203        semantics</a>
204      </h5>
205<div class="informaltable"><table class="table">
206<colgroup>
207<col>
208<col>
209<col>
210</colgroup>
211<thead><tr>
212<th>
213                <p>
214                  Expression
215                </p>
216              </th>
217<th>
218                <p>
219                  Semantics
220                </p>
221              </th>
222<th>
223                <p>
224                  Postcondition
225                </p>
226              </th>
227</tr></thead>
228<tbody>
229<tr>
230<td>
231                <p>
232                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">begin</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code>
233                </p>
234              </td>
235<td>
236                <p>
237                  Returns an iterator pointing to the first element in the Range.
238                </p>
239              </td>
240<td>
241                <p>
242                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">begin</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code>
243                  is either dereferenceable or past-the-end. It is past-the-end if
244                  and only if <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span> <span class="special">==</span> <span class="number">0</span></code>.
245                </p>
246              </td>
247</tr>
248<tr>
249<td>
250                <p>
251                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">end</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code>
252                </p>
253              </td>
254<td>
255                <p>
256                  Returns an iterator pointing one past the last element in the Range.
257                </p>
258              </td>
259<td>
260                <p>
261                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">end</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code>
262                  is past-the-end.
263                </p>
264              </td>
265</tr>
266</tbody>
267</table></div>
268<h5>
269<a name="range.concepts.single_pass_range.h5"></a>
270        <span class="phrase"><a name="range.concepts.single_pass_range.complexity_guarantees"></a></span><a class="link" href="single_pass_range.html#range.concepts.single_pass_range.complexity_guarantees">Complexity
271        guarantees</a>
272      </h5>
273<p>
274        <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">end</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code> is at most amortized linear time, <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">begin</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code> is amortized
275        constant time. For most practical purposes, one can expect both to be amortized
276        constant time.
277      </p>
278<h5>
279<a name="range.concepts.single_pass_range.h6"></a>
280        <span class="phrase"><a name="range.concepts.single_pass_range.invariants"></a></span><a class="link" href="single_pass_range.html#range.concepts.single_pass_range.invariants">Invariants</a>
281      </h5>
282<div class="informaltable"><table class="table">
283<colgroup>
284<col>
285<col>
286</colgroup>
287<thead><tr></tr></thead>
288<tbody>
289<tr>
290<td>
291                <p>
292                  Valid range
293                </p>
294              </td>
295<td>
296                <p>
297                  For any Range <code class="computeroutput"><span class="identifier">a</span></code>,
298                  <code class="computeroutput"><span class="special">[</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">begin</span><span class="special">(</span><span class="identifier">a</span><span class="special">),</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">end</span><span class="special">(</span><span class="identifier">a</span><span class="special">))</span></code> is a valid range, that is, <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">end</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code>
299                  is reachable from <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">begin</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code> in a finite number of increments.
300                </p>
301              </td>
302</tr>
303<tr>
304<td>
305                <p>
306                  Completeness
307                </p>
308              </td>
309<td>
310                <p>
311                  An algorithm that iterates through the range <code class="computeroutput"><span class="special">[</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">begin</span><span class="special">(</span><span class="identifier">a</span><span class="special">),</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">end</span><span class="special">(</span><span class="identifier">a</span><span class="special">))</span></code>
312                  will pass through every element of <code class="computeroutput"><span class="identifier">a</span></code>.
313                </p>
314              </td>
315</tr>
316</tbody>
317</table></div>
318<h5>
319<a name="range.concepts.single_pass_range.h7"></a>
320        <span class="phrase"><a name="range.concepts.single_pass_range.see_also"></a></span><a class="link" href="single_pass_range.html#range.concepts.single_pass_range.see_also">See
321        also</a>
322      </h5>
323<p>
324        <a class="link" href="../reference/extending.html" title="Extending the library">Extending the library for UDTs</a>
325      </p>
326<p>
327        <a class="link" href="../reference/concept_implementation/semantics/metafunctions.html" title="Metafunctions">Implementation
328        of metafunctions</a>
329      </p>
330<p>
331        <a class="link" href="../reference/concept_implementation/semantics/functions.html" title="Functions">Implementation
332        of functions</a>
333      </p>
334<p>
335        <a href="http://www.sgi.com/Technology/STL/Container.html" target="_top">Container</a>
336      </p>
337</div>
338<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
339<td align="left"></td>
340<td align="right"><div class="copyright-footer">Copyright © 2003-2010 Thorsten Ottosen,
341      Neil Groves<p>
342        Distributed under the Boost Software License, Version 1.0. (See accompanying
343        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
344      </p>
345</div></td>
346</tr></table>
347<hr>
348<div class="spirit-nav">
349<a accesskey="p" href="overview.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.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="forward_range.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
350</div>
351</body>
352</html>
353