1 <?xml version=
"1.0" encoding=
"utf-8" ?>
2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en" lang=
"en">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8" />
6 <meta name=
"generator" content=
"Docutils 0.7: http://docutils.sourceforge.net/" />
7 <title>The MPL Reference Manual: Forward Sequence
</title>
8 <link rel=
"stylesheet" href=
"../style.css" type=
"text/css" />
10 <body class=
"docframe refmanual">
11 <table class=
"header"><tr class=
"header"><td class=
"header-group navigation-bar"><span class=
"navigation-group"><a href=
"./concepts.html" class=
"navigation-link">Prev
</a> <a href=
"./bidirectional-sequence.html" class=
"navigation-link">Next
</a></span><span class=
"navigation-group-separator"> |
</span><span class=
"navigation-group">Back
<a href=
"./bidirectional-sequence.html" class=
"navigation-link">Along
</a></span><span class=
"navigation-group-separator"> |
</span><span class=
"navigation-group"><a href=
"./concepts.html" class=
"navigation-link">Up
</a> <a href=
"../refmanual.html" class=
"navigation-link">Home
</a></span><span class=
"navigation-group-separator"> |
</span><span class=
"navigation-group"><a href=
"./refmanual_toc.html" class=
"navigation-link">Full TOC
</a></span></td>
12 <td class=
"header-group page-location"><a href=
"../refmanual.html" class=
"navigation-link">Front Page
</a> /
<a href=
"./sequences.html" class=
"navigation-link">Sequences
</a> /
<a href=
"./concepts.html" class=
"navigation-link">Concepts
</a> /
<a href=
"./forward-sequence.html" class=
"navigation-link">Forward Sequence
</a></td>
13 </tr></table><div class=
"header-separator"></div>
14 <div class=
"section" id=
"forward-sequence">
15 <h1><a class=
"toc-backref" href=
"./concepts.html#id1395">Forward Sequence
</a></h1>
16 <div class=
"section" id=
"description">
18 <p>A
<a class=
"reference internal" href=
"./forward-sequence.html">Forward Sequence
</a> is an MPL concept representing a compile-time sequence of
19 elements. Sequence elements are
20 types, and are accessible through
<a class=
"reference internal" href=
"./iterators.html">Iterators
</a>. The
<a class=
"reference internal" href=
"./begin.html">begin
</a> and
<a class=
"reference internal" href=
"./end.html">end
</a> metafunctions
21 provide iterators delimiting the range of the sequence
22 elements. A sequence guarantees that its elements are arranged in a definite,
23 but possibly unspecified, order. Every MPL sequence is a
<a class=
"reference internal" href=
"./forward-sequence.html">Forward Sequence
</a>.
</p>
25 <div class=
"section" id=
"definitions">
28 <li>The
<em>size
</em> of a sequence is the number of elements it contains. The size is a
29 nonnegative number.
</li>
30 <li>A sequence is
<em>empty
</em> if its size is zero.
</li>
33 <div class=
"section" id=
"expression-requirements">
34 <h3>Expression requirements
</h3>
35 <p>For any
<a class=
"reference internal" href=
"./forward-sequence.html">Forward Sequence
</a> <tt class=
"literal"><span class=
"pre">s
</span></tt> the following expressions must be valid:
</p>
36 <table border=
"1" class=
"docutils table">
42 <thead valign=
"bottom">
43 <tr><th class=
"head">Expression
</th>
44 <th class=
"head">Type
</th>
45 <th class=
"head">Complexity
</th>
49 <tr><td><tt class=
"literal"><span class=
"pre"><a href=
"./begin.html" class=
"identifier">begin
</a><s
>::type
</span></tt></td>
50 <td><a class=
"reference internal" href=
"./forward-iterator.html">Forward Iterator
</a></td>
51 <td>Amortized constant time
</td>
53 <tr><td><tt class=
"literal"><span class=
"pre"><a href=
"./end.html" class=
"identifier">end
</a><s
>::type
</span></tt></td>
54 <td><a class=
"reference internal" href=
"./forward-iterator.html">Forward Iterator
</a></td>
55 <td>Amortized constant time
</td>
57 <tr><td><tt class=
"literal"><span class=
"pre"><a href=
"./size.html" class=
"identifier">size
</a><s
>::type
</span></tt></td>
58 <td><a class=
"reference internal" href=
"./integral-constant.html">Integral Constant
</a></td>
61 <tr><td><tt class=
"literal"><span class=
"pre"><a href=
"./empty.html" class=
"identifier">empty
</a><s
>::type
</span></tt></td>
62 <td>Boolean
<a class=
"reference internal" href=
"./integral-constant.html">Integral Constant
</a></td>
63 <td>Constant time
</td>
65 <tr><td><tt class=
"literal"><span class=
"pre"><a href=
"./front.html" class=
"identifier">front
</a><s
>::type
</span></tt></td>
67 <td>Amortized constant time
</td>
72 <div class=
"section" id=
"expression-semantics">
73 <h3>Expression semantics
</h3>
74 <table border=
"1" class=
"docutils table">
79 <thead valign=
"bottom">
80 <tr><th class=
"head">Expression
</th>
81 <th class=
"head">Semantics
</th>
85 <tr><td><tt class=
"literal"><span class=
"pre"><a href=
"./begin.html" class=
"identifier">begin
</a><s
>::type
</span></tt></td>
86 <td>An iterator to the first element of the sequence; see
<a class=
"reference internal" href=
"./begin.html">begin
</a>.
</td>
88 <tr><td><tt class=
"literal"><span class=
"pre"><a href=
"./end.html" class=
"identifier">end
</a><s
>::type
</span></tt></td>
89 <td>A past-the-end iterator to the sequence; see
<a class=
"reference internal" href=
"./end.html">end
</a>.
</td>
91 <tr><td><tt class=
"literal"><span class=
"pre"><a href=
"./size.html" class=
"identifier">size
</a><s
>::type
</span></tt></td>
92 <td>The size of the sequence; see
<a class=
"reference internal" href=
"./size.html">size
</a>.
</td>
94 <tr><td><tt class=
"literal"><span class=
"pre"><a href=
"./empty.html" class=
"identifier">empty
</a><s
>::type
</span></tt></td>
95 <td>A boolean
<a class=
"reference internal" href=
"./integral-constant.html">Integral Constant
</a> <tt class=
"literal"><span class=
"pre">c
</span></tt> such that
96 <tt class=
"literal"><span class=
"pre">c::value
</span> <span class=
"pre">==
</span> <span class=
"pre">true
</span></tt> if and only if the sequence is empty; see
<a class=
"reference internal" href=
"./empty.html">empty
</a>.
</td>
98 <tr><td><tt class=
"literal"><span class=
"pre"><a href=
"./front.html" class=
"identifier">front
</a><s
>::type
</span></tt></td>
99 <td>The first element in the sequence; see
<a class=
"reference internal" href=
"./front.html">front
</a>.
</td>
104 <div class=
"section" id=
"invariants">
106 <p>For any
<a class=
"reference internal" href=
"./forward-sequence.html">Forward Sequence
</a> <tt class=
"literal"><span class=
"pre">s
</span></tt> the following invariants always hold:
</p>
108 <li>[
<tt class=
"literal"><span class=
"pre"><a href=
"./begin.html" class=
"identifier">begin
</a><s
>::type
</span></tt>,
<tt class=
"literal"><span class=
"pre"><a href=
"./end.html" class=
"identifier">end
</a><s
>::type
</span></tt>) is always a valid range.
</li>
109 <li>An algorithm that iterates through the range [
<tt class=
"literal"><span class=
"pre"><a href=
"./begin.html" class=
"identifier">begin
</a><s
>::type
</span></tt>,
<tt class=
"literal"><span class=
"pre"><a href=
"./end.html" class=
"identifier">end
</a><s
>::type
</span></tt>)
110 will pass through every element of
<tt class=
"literal"><span class=
"pre">s
</span></tt> exactly once.
</li>
111 <li><tt class=
"literal"><span class=
"pre"><a href=
"./begin.html" class=
"identifier">begin
</a><s
>::type
</span></tt> is identical to
<tt class=
"literal"><span class=
"pre"><a href=
"./end.html" class=
"identifier">end
</a><s
>::type
</span></tt> if and only if
<tt class=
"literal"><span class=
"pre">s
</span></tt> is empty.
</li>
112 <li>Two different iterations through
<tt class=
"literal"><span class=
"pre">s
</span></tt> will access its elements in the same order.
</li>
115 <div class=
"section" id=
"models">
118 <li><a class=
"reference internal" href=
"./vector.html">vector
</a></li>
119 <li><a class=
"reference internal" href=
"./map.html">map
</a></li>
120 <li><a class=
"reference internal" href=
"./range-c.html">range_c
</a></li>
121 <li><a class=
"reference internal" href=
"./iterator-range.html">iterator_range
</a></li>
122 <li><a class=
"reference internal" href=
"./filter-view.html">filter_view
</a></li>
125 <div class=
"section" id=
"see-also">
127 <p><a class=
"reference internal" href=
"./sequences.html">Sequences
</a>,
<a class=
"reference internal" href=
"./bidirectional-sequence.html">Bidirectional Sequence
</a>,
<a class=
"reference internal" href=
"./forward-iterator.html">Forward Iterator
</a>,
<a class=
"reference internal" href=
"./begin.html">begin
</a> /
<a class=
"reference internal" href=
"./end.html">end
</a>,
<a class=
"reference internal" href=
"./size.html">size
</a>,
<a class=
"reference internal" href=
"./empty.html">empty
</a>,
<a class=
"reference internal" href=
"./front.html">front
</a></p>
128 <!-- Sequences/Concepts//Bidirectional Sequence |20 -->
132 <div class=
"footer-separator"></div>
133 <table class=
"footer"><tr class=
"footer"><td class=
"header-group navigation-bar"><span class=
"navigation-group"><a href=
"./concepts.html" class=
"navigation-link">Prev
</a> <a href=
"./bidirectional-sequence.html" class=
"navigation-link">Next
</a></span><span class=
"navigation-group-separator"> |
</span><span class=
"navigation-group">Back
<a href=
"./bidirectional-sequence.html" class=
"navigation-link">Along
</a></span><span class=
"navigation-group-separator"> |
</span><span class=
"navigation-group"><a href=
"./concepts.html" class=
"navigation-link">Up
</a> <a href=
"../refmanual.html" class=
"navigation-link">Home
</a></span><span class=
"navigation-group-separator"> |
</span><span class=
"navigation-group"><a href=
"./refmanual_toc.html" class=
"navigation-link">Full TOC
</a></span></td>
134 <td><div class=
"copyright-footer"><div class=
"copyright">Copyright ©
2001-
2009 Aleksey Gurtovoy and David Abrahams
</div>
135 Distributed under the Boost Software License, Version
1.0. (See accompanying
136 file LICENSE_1_0.txt or copy at
<a class=
"reference external" href=
"http://www.boost.org/LICENSE_1_0.txt" target=
"_top">http://www.boost.org/LICENSE_1_0.txt
</a>)
</div></td></tr></table></body>