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"> |
---|
4 | <head> |
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
---|
6 | <meta name="generator" content="Docutils 0.3.6: http://docutils.sourceforge.net/" /> |
---|
7 | <title>The MPL Reference Manual: Forward Sequence</title> |
---|
8 | <link rel="stylesheet" href="../style.css" type="text/css" /> |
---|
9 | </head> |
---|
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#id324" name="forward-sequence">Forward Sequence</a></h1> |
---|
16 | <div class="section" id="description"> |
---|
17 | <h3><a class="subsection-title" href="#description" name="description">Description</a></h3> |
---|
18 | <p>A <a class="reference" 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" href="./iterators.html">Iterators</a>. The <a class="refentry reference" href="./begin.html"><tt class="refentry literal"><span class="pre">begin</span></tt></a> and <a class="refentry reference" href="./end.html"><tt class="refentry literal"><span class="pre">end</span></tt></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" href="./forward-sequence.html">Forward Sequence</a>.</p> |
---|
24 | </div> |
---|
25 | <div class="section" id="definitions"> |
---|
26 | <h3><a class="subsection-title" href="#definitions" name="definitions">Definitions</a></h3> |
---|
27 | <ul class="simple"> |
---|
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> |
---|
31 | </ul> |
---|
32 | </div> |
---|
33 | <div class="section" id="expression-requirements"> |
---|
34 | <h3><a class="subsection-title" href="#expression-requirements" name="expression-requirements">Expression requirements</a></h3> |
---|
35 | <p>For any <a class="reference" 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="table"> |
---|
37 | <colgroup> |
---|
38 | <col width="30%" /> |
---|
39 | <col width="39%" /> |
---|
40 | <col width="30%" /> |
---|
41 | </colgroup> |
---|
42 | <thead valign="bottom"> |
---|
43 | <tr><th>Expression</th> |
---|
44 | <th>Type</th> |
---|
45 | <th>Complexity</th> |
---|
46 | </tr> |
---|
47 | </thead> |
---|
48 | <tbody valign="top"> |
---|
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" href="./forward-iterator.html">Forward Iterator</a></td> |
---|
51 | <td>Amortized constant time</td> |
---|
52 | </tr> |
---|
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" href="./forward-iterator.html">Forward Iterator</a></td> |
---|
55 | <td>Amortized constant time</td> |
---|
56 | </tr> |
---|
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" href="./integral-constant.html">Integral Constant</a></td> |
---|
59 | <td>Unspecified</td> |
---|
60 | </tr> |
---|
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" href="./integral-constant.html">Integral Constant</a></td> |
---|
63 | <td>Constant time</td> |
---|
64 | </tr> |
---|
65 | <tr><td><tt class="literal"><span class="pre"><a href="./front.html" class="identifier">front</a><s>::type</span></tt></td> |
---|
66 | <td>Any type</td> |
---|
67 | <td>Amortized constant time</td> |
---|
68 | </tr> |
---|
69 | </tbody> |
---|
70 | </table> |
---|
71 | </div> |
---|
72 | <div class="section" id="expression-semantics"> |
---|
73 | <h3><a class="subsection-title" href="#expression-semantics" name="expression-semantics">Expression semantics</a></h3> |
---|
74 | <table border="1" class="table"> |
---|
75 | <colgroup> |
---|
76 | <col width="28%" /> |
---|
77 | <col width="72%" /> |
---|
78 | </colgroup> |
---|
79 | <thead valign="bottom"> |
---|
80 | <tr><th>Expression</th> |
---|
81 | <th>Semantics</th> |
---|
82 | </tr> |
---|
83 | </thead> |
---|
84 | <tbody valign="top"> |
---|
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="refentry reference" href="./begin.html"><tt class="refentry literal"><span class="pre">begin</span></tt></a>.</td> |
---|
87 | </tr> |
---|
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="refentry reference" href="./end.html"><tt class="refentry literal"><span class="pre">end</span></tt></a>.</td> |
---|
90 | </tr> |
---|
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="refentry reference" href="./size.html"><tt class="refentry literal"><span class="pre">size</span></tt></a>.</td> |
---|
93 | </tr> |
---|
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" 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="refentry reference" href="./empty.html"><tt class="refentry literal"><span class="pre">empty</span></tt></a>.</td> |
---|
97 | </tr> |
---|
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="refentry reference" href="./front.html"><tt class="refentry literal"><span class="pre">front</span></tt></a>.</td> |
---|
100 | </tr> |
---|
101 | </tbody> |
---|
102 | </table> |
---|
103 | </div> |
---|
104 | <div class="section" id="invariants"> |
---|
105 | <h3><a class="subsection-title" href="#invariants" name="invariants">Invariants</a></h3> |
---|
106 | <p>For any <a class="reference" href="./forward-sequence.html">Forward Sequence</a> <tt class="literal"><span class="pre">s</span></tt> the following invariants always hold:</p> |
---|
107 | <ul class="simple"> |
---|
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> |
---|
113 | </ul> |
---|
114 | </div> |
---|
115 | <div class="section" id="models"> |
---|
116 | <h3><a class="subsection-title" href="#models" name="models">Models</a></h3> |
---|
117 | <ul class="simple"> |
---|
118 | <li><a class="refentry reference" href="./vector.html"><tt class="refentry literal"><span class="pre">vector</span></tt></a></li> |
---|
119 | <li><a class="refentry reference" href="./map.html"><tt class="refentry literal"><span class="pre">map</span></tt></a></li> |
---|
120 | <li><a class="refentry reference" href="./range-c.html"><tt class="refentry literal"><span class="pre">range_c</span></tt></a></li> |
---|
121 | <li><a class="refentry reference" href="./iterator-range.html"><tt class="refentry literal"><span class="pre">iterator_range</span></tt></a></li> |
---|
122 | <li><a class="refentry reference" href="./filter-view.html"><tt class="refentry literal"><span class="pre">filter_view</span></tt></a></li> |
---|
123 | </ul> |
---|
124 | </div> |
---|
125 | <div class="section" id="see-also"> |
---|
126 | <h3><a class="subsection-title" href="#see-also" name="see-also">See also</a></h3> |
---|
127 | <p><a class="reference" href="./sequences.html">Sequences</a>, <a class="reference" href="./bidirectional-sequence.html">Bidirectional Sequence</a>, <a class="reference" href="./forward-iterator.html">Forward Iterator</a>, <a class="refentry reference" href="./begin.html"><tt class="refentry literal"><span class="pre">begin</span></tt></a> / <a class="refentry reference" href="./end.html"><tt class="refentry literal"><span class="pre">end</span></tt></a>, <a class="refentry reference" href="./size.html"><tt class="refentry literal"><span class="pre">size</span></tt></a>, <a class="refentry reference" href="./empty.html"><tt class="refentry literal"><span class="pre">empty</span></tt></a>, <a class="refentry reference" href="./front.html"><tt class="refentry literal"><span class="pre">front</span></tt></a></p> |
---|
128 | <!-- modtime: November 13, 2004 00:38:50 +0000 --> |
---|
129 | <!-- Sequences/Concepts//Bidirectional Sequence |20 --> |
---|
130 | </div> |
---|
131 | </div> |
---|
132 | |
---|
133 | <div class="footer-separator"></div> |
---|
134 | <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> |
---|
135 | </tr></table></body> |
---|
136 | </html> |
---|