Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/mpl/doc/refmanual/variadic-sequence.html @ 29

Last change on this file since 29 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 10.3 KB
Line 
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<!-- Copyright Aleksey Gurtovoy 2006. Distributed under the Boost -->
5<!-- Software License, Version 1.0. (See accompanying -->
6<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
7<head>
8<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9<meta name="generator" content="Docutils 0.3.6: http://docutils.sourceforge.net/" />
10<title>The MPL Reference Manual: Variadic Sequence</title>
11<link rel="stylesheet" href="../style.css" type="text/css" />
12</head>
13<body class="docframe refmanual">
14<table class="header"><tr class="header"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./integral-sequence-wrapper.html" class="navigation-link">Prev</a>&nbsp;<a href="./classes.html" class="navigation-link">Next</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./integral-sequence-wrapper.html" class="navigation-link">Back</a>&nbsp;Along</span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./concepts.html" class="navigation-link">Up</a>&nbsp;<a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td>
15<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="./variadic-sequence.html" class="navigation-link">Variadic Sequence</a></td>
16</tr></table><div class="header-separator"></div>
17<div class="section" id="variadic-sequence">
18<h1><a class="toc-backref" href="./concepts.html#id333" name="variadic-sequence">Variadic Sequence</a></h1>
19<div class="section" id="variadic-description">
20<h3><a class="subsection-title" href="#description" name="description">Description</a></h3>
21<p>A <a class="reference" href="./variadic-sequence.html">Variadic Sequence</a> is a member of a family of sequence classes with both
22<em>variadic</em> and <em>numbered</em> forms. If <tt class="literal"><span class="pre">seq</span></tt> is a generic name for some
23<a class="reference" href="./variadic-sequence.html">Variadic Sequence</a>, its <em>variadic form</em> allows us to specify a sequence of
24<em>n</em> elements <em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub>, for any <em>n</em> from 0 up to a
25<a class="reference" href="./configuration.html">preprocessor-configurable limit</a> <tt class="literal"><span class="pre">BOOST_MPL_LIMIT_</span></tt><em>seq</em><tt class="literal"><span class="pre">_SIZE</span></tt>,
26using the following notation:</p>
27<blockquote>
28<div class="line-block">
29<div class="line"><tt class="literal"><span class="pre">seq&lt;</span></tt><em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub><tt class="literal"><span class="pre">&gt;</span></tt></div>
30</div>
31</blockquote>
32<p>By contrast, each <em>numbered</em> sequence form accepts the exact number of elements
33that is encoded in the name of the corresponding class template:</p>
34<blockquote>
35<div class="line-block">
36<div class="line"><tt class="literal"><span class="pre">seq</span></tt><em>n</em><tt class="literal"><span class="pre">&lt;</span></tt><em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub><tt class="literal"><span class="pre">&gt;</span></tt></div>
37</div>
38</blockquote>
39<p>For numbered forms, there is no predefined top limit for <em>n</em>, aside from compiler
40limitations on the number of template parameters.</p>
41<!-- The variadic form of sequence ``seq`` is defined in
42``<boost/mpl/``\ *seq*\ ``.hpp>`` header.
43The numbered forms are defined in batches of 10.  -->
44</div>
45<div class="section" id="variadic-expression-requirements">
46<h3><a class="subsection-title" href="#expression-requirements" name="expression-requirements">Expression requirements</a></h3>
47<p>In the following table and subsequent specifications, <tt class="literal"><span class="pre">seq</span></tt> is a placeholder token for the actual
48<a class="reference" href="./variadic-sequence.html">Variadic Sequence</a> name.</p>
49<table border="1" class="table">
50<colgroup>
51<col width="35%" />
52<col width="30%" />
53<col width="35%" />
54</colgroup>
55<thead valign="bottom">
56<tr><th>Expression</th>
57<th>Type</th>
58<th>Complexity</th>
59</tr>
60</thead>
61<tbody valign="top">
62<tr><td><tt class="literal"><span class="pre">seq&lt;</span></tt><em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub><tt class="literal"><span class="pre">&gt;</span></tt></td>
63<td><a class="reference" href="./forward-sequence.html">Forward Sequence</a></td>
64<td>Amortized constant time</td>
65</tr>
66<tr><td><tt class="literal"><span class="pre">seq&lt;</span></tt><em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub><tt class="literal"><span class="pre">&gt;::type</span></tt></td>
67<td><a class="reference" href="./forward-sequence.html">Forward Sequence</a></td>
68<td>Amortized constant time</td>
69</tr>
70<tr><td><tt class="literal"><span class="pre">seq</span></tt><em>n</em><tt class="literal"><span class="pre">&lt;</span></tt><em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub><tt class="literal"><span class="pre">&gt;</span></tt></td>
71<td><a class="reference" href="./forward-sequence.html">Forward Sequence</a></td>
72<td>Amortized constant time</td>
73</tr>
74<tr><td><tt class="literal"><span class="pre">seq</span></tt><em>n</em><tt class="literal"><span class="pre">&lt;</span></tt><em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub><tt class="literal"><span class="pre">&gt;::type</span></tt></td>
75<td><a class="reference" href="./forward-sequence.html">Forward Sequence</a></td>
76<td>Amortized constant time</td>
77</tr>
78</tbody>
79</table>
80</div>
81<div class="section" id="variadic-expression-semantics">
82<h3><a class="subsection-title" href="#expression-semantics" name="expression-semantics">Expression semantics</a></h3>
83<pre class="literal-block">
84typedef seq&lt;<em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub>&gt; s;
85typedef seq<em>n</em>&lt;<em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub>&gt; s;
86</pre>
87<table class="field-list" frame="void" rules="none">
88<col class="field-name" />
89<col class="field-body" />
90<tbody valign="top">
91<tr class="field"><th class="field-name">Semantics:</th><td class="field-body"><tt class="literal"><span class="pre">s</span></tt> is a sequence of elements <em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub>.</td>
92</tr>
93<tr class="field"><th class="field-name">Postcondition:</th><td class="field-body"><p class="first"><tt class="literal"><span class="pre"><a href="./size.html" class="identifier">size</a>&lt;s&gt;::value</span> <span class="pre">==</span> <span class="pre">n</span></tt>.</p>
94<!-- FIXME .. parsed-literal::
95
96BOOST_MPL_ASSERT((|is_same|\< at_c<v,0>::type,\ |t1| >));
97BOOST_MPL_ASSERT((|is_same|\< at_c<v,1>::type,\ |t2| >));
98...
99BOOST_MPL_ASSERT((|is_same|\< at_c<v,\ *n*>::type,\ |tn| >)); -->
100</td>
101</tr>
102</tbody>
103</table>
104<!-- .......................................................................... -->
105<pre class="literal-block">
106typedef seq&lt;<em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub>&gt;::type s;
107typedef seq<em>n</em>&lt;<em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub>&gt;::type s;
108</pre>
109<table class="field-list" frame="void" rules="none">
110<col class="field-name" />
111<col class="field-body" />
112<tbody valign="top">
113<tr class="field"><th class="field-name">Semantics:</th><td class="field-body"><tt class="literal"><span class="pre">s</span></tt> is identical to <tt class="literal"><span class="pre">seq</span></tt><em>n</em><tt class="literal"><span class="pre">&lt;</span></tt><em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub> <tt class="literal"><span class="pre">&gt;</span></tt>.</td>
114</tr>
115<tr class="field"><th class="field-name">Postcondition:</th><td class="field-body"><tt class="literal"><span class="pre"><a href="./size.html" class="identifier">size</a>&lt;s&gt;::value</span> <span class="pre">==</span> <span class="pre">n</span></tt>.</td>
116</tr>
117</tbody>
118</table>
119</div>
120<div class="section" id="variadic-models">
121<h3><a class="subsection-title" href="#models" name="models">Models</a></h3>
122<ul class="simple">
123<li><a class="refentry reference" href="./vector.html"><tt class="refentry literal"><span class="pre">vector</span></tt></a></li>
124<li><a class="refentry reference" href="./list.html"><tt class="refentry literal"><span class="pre">list</span></tt></a></li>
125<li><a class="refentry reference" href="./map.html"><tt class="refentry literal"><span class="pre">map</span></tt></a></li>
126</ul>
127</div>
128<div class="section" id="variadic-see-also">
129<h3><a class="subsection-title" href="#see-also" name="see-also">See also</a></h3>
130<p><a class="reference" href="./sequences.html">Sequences</a>, <a class="reference" href="./configuration.html">Configuration</a>, <a class="reference" href="./integral-sequence-wrapper.html">Integral Sequence Wrapper</a></p>
131<!-- modtime: November 13, 2004 01:43:48 +0000 -->
132</div>
133</div>
134
135<div class="footer-separator"></div>
136<table class="footer"><tr class="footer"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./integral-sequence-wrapper.html" class="navigation-link">Prev</a>&nbsp;<a href="./classes.html" class="navigation-link">Next</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./integral-sequence-wrapper.html" class="navigation-link">Back</a>&nbsp;Along</span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./concepts.html" class="navigation-link">Up</a>&nbsp;<a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td>
137</tr></table></body>
138</html>
Note: See TracBrowser for help on using the repository browser.