• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Forward Sequence</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. Fusion 2.2">
8<link rel="up" href="../concepts.html" title="Concepts">
9<link rel="prev" href="../concepts.html" title="Concepts">
10<link rel="next" href="bidirectional_sequence.html" title="Bidirectional Sequence">
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="../concepts.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="bidirectional_sequence.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h4 class="title">
27<a name="fusion.sequence.concepts.forward_sequence"></a><a class="link" href="forward_sequence.html" title="Forward Sequence">Forward
28        Sequence</a>
29</h4></div></div></div>
30<h6>
31<a name="fusion.sequence.concepts.forward_sequence.h0"></a>
32          <span class="phrase"><a name="fusion.sequence.concepts.forward_sequence.description"></a></span><a class="link" href="forward_sequence.html#fusion.sequence.concepts.forward_sequence.description">Description</a>
33        </h6>
34<p>
35          A Forward Sequence is a Sequence whose elements are arranged in a definite
36          order. The ordering is guaranteed not to change from iteration to iteration.
37          The requirement of a definite ordering allows the definition of element-by-element
38          equality (if the container's element type is Equality Comparable) and of
39          lexicographical ordering (if the container's element type is LessThan Comparable).
40        </p>
41<div class="variablelist">
42<p class="title"><b>Notation</b></p>
43<dl class="variablelist">
44<dt><span class="term"><code class="computeroutput"><span class="identifier">s</span></code></span></dt>
45<dd><p>
46                A Forward Sequence
47              </p></dd>
48<dt><span class="term"><code class="computeroutput"><span class="identifier">S</span></code></span></dt>
49<dd><p>
50                A Forward Sequence type
51              </p></dd>
52<dt><span class="term"><code class="computeroutput"><span class="identifier">o</span></code></span></dt>
53<dd><p>
54                An arbitrary object
55              </p></dd>
56<dt><span class="term"><code class="computeroutput"><span class="identifier">e</span></code></span></dt>
57<dd><p>
58                A Sequence element
59              </p></dd>
60</dl>
61</div>
62<h6>
63<a name="fusion.sequence.concepts.forward_sequence.h1"></a>
64          <span class="phrase"><a name="fusion.sequence.concepts.forward_sequence.valid_expressions"></a></span><a class="link" href="forward_sequence.html#fusion.sequence.concepts.forward_sequence.valid_expressions">Valid
65          Expressions</a>
66        </h6>
67<p>
68          For any Forward Sequence the following expressions must be valid:
69        </p>
70<div class="informaltable"><table class="table">
71<colgroup>
72<col>
73<col>
74<col>
75<col>
76</colgroup>
77<thead><tr>
78<th>
79                  <p>
80                    Expression
81                  </p>
82                </th>
83<th>
84                  <p>
85                    Return type
86                  </p>
87                </th>
88<th>
89                  <p>
90                    Type Requirements
91                  </p>
92                </th>
93<th>
94                  <p>
95                    Runtime Complexity
96                  </p>
97                </th>
98</tr></thead>
99<tbody>
100<tr>
101<td>
102                  <p>
103                    <code class="computeroutput"><a class="link" href="../intrinsic/functions/begin.html" title="begin"><code class="computeroutput"><span class="identifier">begin</span></code></a><span class="special">(</span><span class="identifier">s</span><span class="special">)</span></code>
104                  </p>
105                </td>
106<td>
107                  <p>
108                    <a class="link" href="../../iterator/concepts/forward_iterator.html" title="Forward Iterator">Forward
109                    Iterator</a>
110                  </p>
111                </td>
112<td>
113                </td>
114<td>
115                  <p>
116                    Constant
117                  </p>
118                </td>
119</tr>
120<tr>
121<td>
122                  <p>
123                    <code class="computeroutput"><a class="link" href="../intrinsic/functions/end.html" title="end"><code class="computeroutput"><span class="identifier">end</span></code></a><span class="special">(</span><span class="identifier">s</span><span class="special">)</span></code>
124                  </p>
125                </td>
126<td>
127                  <p>
128                    <a class="link" href="../../iterator/concepts/forward_iterator.html" title="Forward Iterator">Forward
129                    Iterator</a>
130                  </p>
131                </td>
132<td>
133                </td>
134<td>
135                  <p>
136                    Constant
137                  </p>
138                </td>
139</tr>
140<tr>
141<td>
142                  <p>
143                    <code class="computeroutput"><a class="link" href="../intrinsic/functions/size.html" title="size"><code class="computeroutput"><span class="identifier">size</span></code></a><span class="special">(</span><span class="identifier">s</span><span class="special">)</span></code>
144                  </p>
145                </td>
146<td>
147                  <p>
148                    <a href="http://www.boost.org/libs/mpl/doc/refmanual/integral-constant.html" target="_top">MPL
149                    Integral Constant</a>. Convertible to int.
150                  </p>
151                </td>
152<td>
153                </td>
154<td>
155                  <p>
156                    Constant
157                  </p>
158                </td>
159</tr>
160<tr>
161<td>
162                  <p>
163                    <code class="computeroutput"><a class="link" href="../intrinsic/functions/empty.html" title="empty"><code class="computeroutput"><span class="identifier">empty</span></code></a><span class="special">(</span><span class="identifier">s</span><span class="special">)</span></code>
164                  </p>
165                </td>
166<td>
167                  <p>
168                    <a href="http://www.boost.org/libs/mpl/doc/refmanual/integral-constant.html" target="_top">MPL
169                    Boolean Constant</a>. Convertible to bool.
170                  </p>
171                </td>
172<td>
173                </td>
174<td>
175                  <p>
176                    Constant
177                  </p>
178                </td>
179</tr>
180<tr>
181<td>
182                  <p>
183                    <code class="computeroutput"><a class="link" href="../intrinsic/functions/front.html" title="front"><code class="computeroutput"><span class="identifier">front</span></code></a><span class="special">(</span><span class="identifier">s</span><span class="special">)</span></code>
184                  </p>
185                </td>
186<td>
187                  <p>
188                    Any type
189                  </p>
190                </td>
191<td>
192                </td>
193<td>
194                  <p>
195                    Constant
196                  </p>
197                </td>
198</tr>
199<tr>
200<td>
201                  <p>
202                    <code class="computeroutput"><a class="link" href="../intrinsic/functions/front.html" title="front"><code class="computeroutput"><span class="identifier">front</span></code></a><span class="special">(</span><span class="identifier">s</span><span class="special">)</span>
203                    <span class="special">=</span> <span class="identifier">o</span></code>
204                  </p>
205                </td>
206<td>
207                  <p>
208                    Any type
209                  </p>
210                </td>
211<td>
212                  <p>
213                    <code class="computeroutput"><span class="identifier">s</span></code> is mutable
214                    and <code class="computeroutput"><span class="identifier">e</span> <span class="special">=</span>
215                    <span class="identifier">o</span></code>, where <code class="computeroutput"><span class="identifier">e</span></code> is the first element in the
216                    sequence, is a valid expression.
217                  </p>
218                </td>
219<td>
220                  <p>
221                    Constant
222                  </p>
223                </td>
224</tr>
225</tbody>
226</table></div>
227<h6>
228<a name="fusion.sequence.concepts.forward_sequence.h2"></a>
229          <span class="phrase"><a name="fusion.sequence.concepts.forward_sequence.result_type_expressions"></a></span><a class="link" href="forward_sequence.html#fusion.sequence.concepts.forward_sequence.result_type_expressions">Result
230          Type Expressions</a>
231        </h6>
232<div class="informaltable"><table class="table">
233<colgroup>
234<col>
235<col>
236</colgroup>
237<thead><tr>
238<th>
239                  <p>
240                    Expression
241                  </p>
242                </th>
243<th>
244                  <p>
245                    Compile Time Complexity
246                  </p>
247                </th>
248</tr></thead>
249<tbody>
250<tr>
251<td>
252                  <p>
253                    <code class="computeroutput"><a class="link" href="../intrinsic/metafunctions/begin.html" title="begin"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">begin</span></code></a><span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
254                  </p>
255                </td>
256<td>
257                  <p>
258                    Amortized constant time
259                  </p>
260                </td>
261</tr>
262<tr>
263<td>
264                  <p>
265                    <code class="computeroutput"><a class="link" href="../intrinsic/metafunctions/end.html" title="end"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">end</span></code></a><span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
266                  </p>
267                </td>
268<td>
269                  <p>
270                    Amortized constant time
271                  </p>
272                </td>
273</tr>
274<tr>
275<td>
276                  <p>
277                    <code class="computeroutput"><a class="link" href="../intrinsic/metafunctions/size.html" title="size"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">size</span></code></a><span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
278                  </p>
279                </td>
280<td>
281                  <p>
282                    Unspecified
283                  </p>
284                </td>
285</tr>
286<tr>
287<td>
288                  <p>
289                    <code class="computeroutput"><a class="link" href="../intrinsic/metafunctions/empty.html" title="empty"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">empty</span></code></a><span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
290                  </p>
291                </td>
292<td>
293                  <p>
294                    Constant time
295                  </p>
296                </td>
297</tr>
298<tr>
299<td>
300                  <p>
301                    <code class="computeroutput"><a class="link" href="../intrinsic/metafunctions/front.html" title="front"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">front</span></code></a><span class="special">&lt;</span><span class="identifier">S</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
302                  </p>
303                </td>
304<td>
305                  <p>
306                    Amortized constant time
307                  </p>
308                </td>
309</tr>
310</tbody>
311</table></div>
312<h6>
313<a name="fusion.sequence.concepts.forward_sequence.h3"></a>
314          <span class="phrase"><a name="fusion.sequence.concepts.forward_sequence.expression_semantics"></a></span><a class="link" href="forward_sequence.html#fusion.sequence.concepts.forward_sequence.expression_semantics">Expression
315          Semantics</a>
316        </h6>
317<div class="informaltable"><table class="table">
318<colgroup>
319<col>
320<col>
321</colgroup>
322<thead><tr>
323<th>
324                  <p>
325                    Expression
326                  </p>
327                </th>
328<th>
329                  <p>
330                    Semantics
331                  </p>
332                </th>
333</tr></thead>
334<tbody>
335<tr>
336<td>
337                  <p>
338                    <code class="computeroutput"><a class="link" href="../intrinsic/functions/begin.html" title="begin"><code class="computeroutput"><span class="identifier">begin</span></code></a><span class="special">(</span><span class="identifier">s</span><span class="special">)</span></code>
339                  </p>
340                </td>
341<td>
342                  <p>
343                    An iterator to the first element of the sequence; see <a class="link" href="../intrinsic/functions/begin.html" title="begin"><code class="computeroutput"><span class="identifier">begin</span></code></a>.
344                  </p>
345                </td>
346</tr>
347<tr>
348<td>
349                  <p>
350                    <code class="computeroutput"><a class="link" href="../intrinsic/functions/end.html" title="end"><code class="computeroutput"><span class="identifier">end</span></code></a><span class="special">(</span><span class="identifier">s</span><span class="special">)</span></code>
351                  </p>
352                </td>
353<td>
354                  <p>
355                    A past-the-end iterator to the sequence; see <a class="link" href="../intrinsic/functions/end.html" title="end"><code class="computeroutput"><span class="identifier">end</span></code></a>.
356                  </p>
357                </td>
358</tr>
359<tr>
360<td>
361                  <p>
362                    <code class="computeroutput"><a class="link" href="../intrinsic/functions/size.html" title="size"><code class="computeroutput"><span class="identifier">size</span></code></a><span class="special">(</span><span class="identifier">s</span><span class="special">)</span></code>
363                  </p>
364                </td>
365<td>
366                  <p>
367                    The size of the sequence; see <a class="link" href="../intrinsic/functions/size.html" title="size"><code class="computeroutput"><span class="identifier">size</span></code></a>.
368                  </p>
369                </td>
370</tr>
371<tr>
372<td>
373                  <p>
374                    <code class="computeroutput"><a class="link" href="../intrinsic/functions/empty.html" title="empty"><code class="computeroutput"><span class="identifier">empty</span></code></a><span class="special">(</span><span class="identifier">s</span><span class="special">)</span></code>
375                  </p>
376                </td>
377<td>
378                  <p>
379                    A boolean Integral Constant <code class="computeroutput"><span class="identifier">c</span></code>
380                    such that <code class="computeroutput"><span class="identifier">c</span><span class="special">::</span><span class="identifier">value</span> <span class="special">==</span>
381                    <span class="keyword">true</span></code> if and only if the
382                    sequence is empty; see <a class="link" href="../intrinsic/functions/empty.html" title="empty"><code class="computeroutput"><span class="identifier">empty</span></code></a>.
383                  </p>
384                </td>
385</tr>
386<tr>
387<td>
388                  <p>
389                    <code class="computeroutput"><a class="link" href="../intrinsic/functions/front.html" title="front"><code class="computeroutput"><span class="identifier">front</span></code></a><span class="special">(</span><span class="identifier">s</span><span class="special">)</span></code>
390                  </p>
391                </td>
392<td>
393                  <p>
394                    The first element in the sequence; see <a class="link" href="../intrinsic/functions/front.html" title="front"><code class="computeroutput"><span class="identifier">front</span></code></a>.
395                  </p>
396                </td>
397</tr>
398</tbody>
399</table></div>
400<h6>
401<a name="fusion.sequence.concepts.forward_sequence.h4"></a>
402          <span class="phrase"><a name="fusion.sequence.concepts.forward_sequence.invariants"></a></span><a class="link" href="forward_sequence.html#fusion.sequence.concepts.forward_sequence.invariants">Invariants</a>
403        </h6>
404<p>
405          For any Forward Sequence s the following invariants always hold:
406        </p>
407<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
408<li class="listitem">
409              <code class="computeroutput"><span class="special">[</span><a class="link" href="../intrinsic/functions/begin.html" title="begin"><code class="computeroutput"><span class="identifier">begin</span></code></a><span class="special">(</span><span class="identifier">s</span><span class="special">),</span> <a class="link" href="../intrinsic/functions/end.html" title="end"><code class="computeroutput"><span class="identifier">end</span></code></a><span class="special">(</span><span class="identifier">s</span><span class="special">))</span></code> is always a valid range.
410            </li>
411<li class="listitem">
412              An <a class="link" href="../../algorithm.html" title="Algorithm">Algorithm</a> that iterates
413              through the range <code class="computeroutput"><span class="special">[</span><a class="link" href="../intrinsic/functions/begin.html" title="begin"><code class="computeroutput"><span class="identifier">begin</span></code></a><span class="special">(</span><span class="identifier">s</span><span class="special">),</span> <a class="link" href="../intrinsic/functions/end.html" title="end"><code class="computeroutput"><span class="identifier">end</span></code></a><span class="special">(</span><span class="identifier">s</span><span class="special">))</span></code> will pass through every element of
414              <code class="computeroutput"><span class="identifier">s</span></code> exactly once.
415            </li>
416<li class="listitem">
417              <code class="computeroutput"><a class="link" href="../intrinsic/functions/begin.html" title="begin"><code class="computeroutput"><span class="identifier">begin</span></code></a><span class="special">(</span><span class="identifier">s</span><span class="special">)</span></code>
418              is identical to <code class="computeroutput"><a class="link" href="../intrinsic/functions/end.html" title="end"><code class="computeroutput"><span class="identifier">end</span></code></a><span class="special">(</span><span class="identifier">s</span><span class="special">))</span></code>
419              if and only if <code class="computeroutput"><span class="identifier">s</span></code> is
420              empty.
421            </li>
422<li class="listitem">
423              Two different iterations through <code class="computeroutput"><span class="identifier">s</span></code>
424              will access its elements in the same order.
425            </li>
426</ul></div>
427<h6>
428<a name="fusion.sequence.concepts.forward_sequence.h5"></a>
429          <span class="phrase"><a name="fusion.sequence.concepts.forward_sequence.models"></a></span><a class="link" href="forward_sequence.html#fusion.sequence.concepts.forward_sequence.models">Models</a>
430        </h6>
431<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
432<li class="listitem">
433              <a class="link" href="../../adapted/std__pair.html" title="std::pair"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span></code></a>
434            </li>
435<li class="listitem">
436              <a class="link" href="../../adapted/boost__array.html" title="boost::array"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">array</span></code></a>
437            </li>
438<li class="listitem">
439              <a class="link" href="../../container/vector.html" title="vector"><code class="computeroutput"><span class="identifier">vector</span></code></a>
440            </li>
441<li class="listitem">
442              <a class="link" href="../../container/cons.html" title="cons"><code class="computeroutput"><span class="identifier">cons</span></code></a>
443            </li>
444<li class="listitem">
445              <a class="link" href="../../container/list.html" title="list"><code class="computeroutput"><span class="identifier">list</span></code></a>
446            </li>
447<li class="listitem">
448              <a class="link" href="../../container/set.html" title="set"><code class="computeroutput"><span class="identifier">set</span></code></a>
449            </li>
450<li class="listitem">
451              <a class="link" href="../../container/map.html" title="map"><code class="computeroutput"><span class="identifier">map</span></code></a>
452            </li>
453<li class="listitem">
454              <a class="link" href="../../view/single_view.html" title="single_view"><code class="computeroutput"><span class="identifier">single_view</span></code></a>
455            </li>
456<li class="listitem">
457              <a class="link" href="../../view/filter_view.html" title="filter_view"><code class="computeroutput"><span class="identifier">filter_view</span></code></a>
458            </li>
459<li class="listitem">
460              <a class="link" href="../../view/iterator_range.html" title="iterator_range"><code class="computeroutput"><span class="identifier">iterator_range</span></code></a>
461            </li>
462<li class="listitem">
463              <a class="link" href="../../view/joint_view.html" title="joint_view"><code class="computeroutput"><span class="identifier">joint_view</span></code></a>
464            </li>
465<li class="listitem">
466              <a class="link" href="../../view/transform_view.html" title="transform_view"><code class="computeroutput"><span class="identifier">transform_view</span></code></a>
467            </li>
468<li class="listitem">
469              <a class="link" href="../../view/reverse_view.html" title="reverse_view"><code class="computeroutput"><span class="identifier">reverse_view</span></code></a>
470            </li>
471<li class="listitem">
472              <a class="link" href="../../view/zip_view.html" title="zip_view"><code class="computeroutput"><span class="identifier">zip_view</span></code></a>
473            </li>
474</ul></div>
475</div>
476<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
477<td align="left"></td>
478<td align="right"><div class="copyright-footer">Copyright © 2001-2006, 2011, 2012 Joel de Guzman,
479      Dan Marsden, Tobias Schwinger<p>
480        Distributed under the Boost Software License, Version 1.0. (See accompanying
481        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>)
482      </p>
483</div></td>
484</tr></table>
485<hr>
486<div class="spirit-nav">
487<a accesskey="p" href="../concepts.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="bidirectional_sequence.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
488</div>
489</body>
490</html>
491