forked from boostorg/fusion
@ -3,10 +3,10 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>list</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
|
||||
<link rel="start" href="../../index.html" title="Chapter<65>1.<2E>Fusion 2.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter<65>1.<2E>Fusion 2.0">
|
||||
<link rel="up" href="../container.html" title="Container">
|
||||
<link rel="prev" href="cons.html" title="cons">
|
||||
<link rel="previous" href="cons.html" title="cons">
|
||||
<link rel="next" href="set.html" title="set">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
@ -23,22 +23,26 @@
|
||||
<a accesskey="p" href="cons.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../container.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="set.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="fusion.container.list"></a><a href="list.html" title="list">list</a></h3></div></div></div>
|
||||
<div class="titlepage">
|
||||
<div><div><h3 class="title">
|
||||
<a name="fusion.container.list"></a><a href="list.html" title="list">list</a>
|
||||
</h3></div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
<a name="fusion.container.list.description"></a><h4>
|
||||
<a name="id1072172"></a>
|
||||
<a name="id483314"></a>
|
||||
<a href="list.html#fusion.container.list.description">Description</a>
|
||||
</h4>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">list</span></code> is a <a href="../sequence/concepts/forward_sequence.html" title="Forward
|
||||
<tt class="computeroutput"><span class="identifier">list</span></tt> is a <a href="../sequence/concepts/forward_sequence.html" title="Forward
|
||||
Sequence">Forward
|
||||
Sequence</a> of heterogenous typed data built on top of <a href="cons.html" title="cons"><code class="computeroutput"><span class="identifier">cons</span></code></a>. It is more efficient than
|
||||
<a href="vector.html" title="vector"><code class="computeroutput"><span class="identifier">vector</span></code></a>
|
||||
Sequence</a> of heterogenous typed data built on top of <a href="cons.html" title="cons"><tt class="computeroutput"><span class="identifier">cons</span></tt></a>. It is more efficient than
|
||||
<a href="vector.html" title="vector"><tt class="computeroutput"><span class="identifier">vector</span></tt></a>
|
||||
when the target sequence is constructed piecemeal (a data at a time). The
|
||||
runtime cost of access to each element is peculiarly constant (see <a href="../notes.html#fusion.notes.recursive_inlined_functions">Recursive Inlined Functions</a>).
|
||||
</p>
|
||||
<a name="fusion.container.list.header"></a><h4>
|
||||
<a name="id1072257"></a>
|
||||
<a name="id483409"></a>
|
||||
<a href="list.html#fusion.container.list.header">Header</a>
|
||||
</h4>
|
||||
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">container</span><span class="special">/</span><span class="identifier">list</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
@ -47,7 +51,7 @@
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">list_fwd</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
</pre>
|
||||
<a name="fusion.container.list.synopsis"></a><h4>
|
||||
<a name="id1072512"></a>
|
||||
<a name="id483700"></a>
|
||||
<a href="list.html#fusion.container.list.synopsis">Synopsis</a>
|
||||
</h4>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span>
|
||||
@ -60,22 +64,22 @@
|
||||
<span class="keyword">struct</span> <span class="identifier">list</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
The variadic class interface accepts <code class="computeroutput"><span class="number">0</span></code>
|
||||
to <code class="computeroutput"><span class="identifier">FUSION_MAX_LIST_SIZE</span></code> elements,
|
||||
where <code class="computeroutput"><span class="identifier">FUSION_MAX_LIST_SIZE</span></code>
|
||||
is a user definable predefined maximum that defaults to <code class="computeroutput"><span class="number">10</span></code>.
|
||||
The variadic class interface accepts <tt class="computeroutput"><span class="number">0</span></tt>
|
||||
to <tt class="computeroutput"><span class="identifier">FUSION_MAX_LIST_SIZE</span></tt> elements,
|
||||
where <tt class="computeroutput"><span class="identifier">FUSION_MAX_LIST_SIZE</span></tt>
|
||||
is a user definable predefined maximum that defaults to <tt class="computeroutput"><span class="number">10</span></tt>.
|
||||
Example:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">list</span><span class="special"><</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span><span class="special">,</span> <span class="keyword">double</span><span class="special">></span>
|
||||
</pre>
|
||||
<p>
|
||||
You may define the preprocessor constant <code class="computeroutput"><span class="identifier">FUSION_MAX_LIST_SIZE</span></code>
|
||||
You may define the preprocessor constant <tt class="computeroutput"><span class="identifier">FUSION_MAX_LIST_SIZE</span></tt>
|
||||
before including any Fusion header to change the default. Example:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">FUSION_MAX_LIST_SIZE</span> <span class="number">20</span>
|
||||
</pre>
|
||||
<a name="fusion.container.list.template_parameters"></a><h4>
|
||||
<a name="id1072801"></a>
|
||||
<a name="id484026"></a>
|
||||
<a href="list.html#fusion.container.list.template_parameters">Template parameters</a>
|
||||
</h4>
|
||||
<div class="informaltable"><table class="table">
|
||||
@ -85,42 +89,30 @@
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
<th><p>
|
||||
Parameter
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
</p></th>
|
||||
<th><p>
|
||||
Description
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
</p></th>
|
||||
<th><p>
|
||||
Default
|
||||
</p>
|
||||
</th>
|
||||
</p></th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">T0</span></code>...<code class="computeroutput"><span class="identifier">TN</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<td><p>
|
||||
<tt class="computeroutput"><span class="identifier">T0</span></tt>...<tt class="computeroutput"><span class="identifier">TN</span></tt>
|
||||
</p></td>
|
||||
<td><p>
|
||||
Element types
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
</p></td>
|
||||
<td><p>
|
||||
<span class="emphasis"><em>unspecified-type</em></span>
|
||||
</p>
|
||||
</td>
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<a name="fusion.container.list.model_of"></a><h4>
|
||||
<a name="id1072906"></a>
|
||||
<a name="id484144"></a>
|
||||
<a href="list.html#fusion.container.list.model_of">Model of</a>
|
||||
</h4>
|
||||
<div class="itemizedlist"><ul type="disc"><li><a href="../sequence/concepts/forward_sequence.html" title="Forward
|
||||
@ -128,24 +120,24 @@
|
||||
<div class="variablelist">
|
||||
<p class="title"><b>Notation</b></p>
|
||||
<dl>
|
||||
<dt><span class="term"><code class="computeroutput"><span class="identifier">L</span></code></span></dt>
|
||||
<dt><span class="term"><tt class="computeroutput"><span class="identifier">L</span></tt></span></dt>
|
||||
<dd><p>
|
||||
A <code class="computeroutput"><span class="identifier">list</span></code> type
|
||||
A <tt class="computeroutput"><span class="identifier">list</span></tt> type
|
||||
</p></dd>
|
||||
<dt><span class="term"><code class="computeroutput"><span class="identifier">l</span></code></span></dt>
|
||||
<dt><span class="term"><tt class="computeroutput"><span class="identifier">l</span></tt></span></dt>
|
||||
<dd><p>
|
||||
An instance of <code class="computeroutput"><span class="identifier">list</span></code>
|
||||
An instance of <tt class="computeroutput"><span class="identifier">list</span></tt>
|
||||
</p></dd>
|
||||
<dt><span class="term"><code class="computeroutput"><span class="identifier">e0</span></code>...<code class="computeroutput"><span class="identifier">en</span></code></span></dt>
|
||||
<dt><span class="term"><tt class="computeroutput"><span class="identifier">e0</span></tt>...<tt class="computeroutput"><span class="identifier">en</span></tt></span></dt>
|
||||
<dd><p>
|
||||
Heterogeneous values
|
||||
</p></dd>
|
||||
<dt><span class="term"><code class="computeroutput"><span class="identifier">s</span></code></span></dt>
|
||||
<dt><span class="term"><tt class="computeroutput"><span class="identifier">s</span></tt></span></dt>
|
||||
<dd><p>
|
||||
A <a href="../sequence/concepts/forward_sequence.html" title="Forward
|
||||
Sequence">Forward Sequence</a>
|
||||
</p></dd>
|
||||
<dt><span class="term"><code class="computeroutput"><span class="identifier">N</span></code></span></dt>
|
||||
<dt><span class="term"><tt class="computeroutput"><span class="identifier">N</span></tt></span></dt>
|
||||
<dd><p>
|
||||
An <a href="http://www.boost.org/libs/mpl/doc/refmanual/integral-constant.html" target="_top">MPL
|
||||
Integral Constant</a>
|
||||
@ -153,7 +145,7 @@
|
||||
</dl>
|
||||
</div>
|
||||
<a name="fusion.container.list.expression_semantics"></a><h4>
|
||||
<a name="id1073095"></a>
|
||||
<a name="id484357"></a>
|
||||
<a href="list.html#fusion.container.list.expression_semantics">Expression Semantics</a>
|
||||
</h4>
|
||||
<p>
|
||||
@ -168,105 +160,81 @@
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
<th><p>
|
||||
Expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
</p></th>
|
||||
<th><p>
|
||||
Semantics
|
||||
</p>
|
||||
</th>
|
||||
</p></th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">L</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<td><p>
|
||||
<tt class="computeroutput"><span class="identifier">L</span><span class="special">()</span></tt>
|
||||
</p></td>
|
||||
<td><p>
|
||||
Creates a list with default constructed elements.
|
||||
</p>
|
||||
</td>
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">L</span><span class="special">(</span><span class="identifier">e0</span><span class="special">,</span> <span class="identifier">e1</span><span class="special">,...</span>
|
||||
<span class="identifier">en</span><span class="special">)</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Creates a list with elements <code class="computeroutput"><span class="identifier">e0</span></code>...<code class="computeroutput"><span class="identifier">en</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
<td><p>
|
||||
<tt class="computeroutput"><span class="identifier">L</span><span class="special">(</span><span class="identifier">e0</span><span class="special">,</span> <span class="identifier">e1</span><span class="special">,...</span>
|
||||
<span class="identifier">en</span><span class="special">)</span></tt>
|
||||
</p></td>
|
||||
<td><p>
|
||||
Creates a list with elements <tt class="computeroutput"><span class="identifier">e0</span></tt>...<tt class="computeroutput"><span class="identifier">en</span></tt>.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">L</span><span class="special">(</span><span class="identifier">s</span><span class="special">)</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<td><p>
|
||||
<tt class="computeroutput"><span class="identifier">L</span><span class="special">(</span><span class="identifier">s</span><span class="special">)</span></tt>
|
||||
</p></td>
|
||||
<td><p>
|
||||
Copy constructs a list from a <a href="../sequence/concepts/forward_sequence.html" title="Forward
|
||||
Sequence">Forward
|
||||
Sequence</a>, <code class="computeroutput"><span class="identifier">s</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
Sequence</a>, <tt class="computeroutput"><span class="identifier">s</span></tt>.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">l</span> <span class="special">=</span>
|
||||
<span class="identifier">s</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Assigns to a list, <code class="computeroutput"><span class="identifier">l</span></code>,
|
||||
<td><p>
|
||||
<tt class="computeroutput"><span class="identifier">l</span> <span class="special">=</span>
|
||||
<span class="identifier">s</span></tt>
|
||||
</p></td>
|
||||
<td><p>
|
||||
Assigns to a list, <tt class="computeroutput"><span class="identifier">l</span></tt>,
|
||||
from a <a href="../sequence/concepts/forward_sequence.html" title="Forward
|
||||
Sequence">Forward
|
||||
Sequence</a>, <code class="computeroutput"><span class="identifier">s</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
Sequence</a>, <tt class="computeroutput"><span class="identifier">s</span></tt>.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><a href="../sequence/intrinsic/functions/at.html" title="at"><code class="computeroutput"><span class="identifier">at</span></code></a><span class="special"><</span><span class="identifier">N</span><span class="special">>(</span><span class="identifier">l</span><span class="special">)</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The Nth element from the beginning of the sequence; see <a href="../sequence/intrinsic/functions/at.html" title="at"><code class="computeroutput"><span class="identifier">at</span></code></a>.
|
||||
</p>
|
||||
</td>
|
||||
<td><p>
|
||||
<tt class="computeroutput"><a href="../sequence/intrinsic/functions/at.html" title="at"><tt class="computeroutput"><span class="identifier">at</span></tt></a><span class="special"><</span><span class="identifier">N</span><span class="special">>(</span><span class="identifier">l</span><span class="special">)</span></tt>
|
||||
</p></td>
|
||||
<td><p>
|
||||
The Nth element from the beginning of the sequence; see <a href="../sequence/intrinsic/functions/at.html" title="at"><tt class="computeroutput"><span class="identifier">at</span></tt></a>.
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<div class="sidebar"><p>
|
||||
<span class="inlinemediaobject"><img src="../../images/note.png" alt="note"></span> <code class="computeroutput"><a href="../sequence/intrinsic/functions/at.html" title="at"><code class="computeroutput"><span class="identifier">at</span></code></a><span class="special"><</span><span class="identifier">n</span><span class="special">>(</span><span class="identifier">l</span><span class="special">)</span></code> is provided
|
||||
<span class="inlinemediaobject"><img src="images/note.png" alt="note"></span> <tt class="computeroutput"><a href="../sequence/intrinsic/functions/at.html" title="at"><tt class="computeroutput"><span class="identifier">at</span></tt></a><span class="special"><</span><span class="identifier">n</span><span class="special">>(</span><span class="identifier">l</span><span class="special">)</span></tt> is provided
|
||||
for convenience and compatibility with the original <a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html" target="_top">Boost.Tuple</a>
|
||||
library, despite <code class="computeroutput"><span class="identifier">list</span></code> being
|
||||
library, despite <tt class="computeroutput"><span class="identifier">list</span></tt> being
|
||||
a <a href="../sequence/concepts/forward_sequence.html" title="Forward
|
||||
Sequence">Forward Sequence</a>
|
||||
only (<a href="../sequence/intrinsic/functions/at.html" title="at"><code class="computeroutput"><span class="identifier">at</span></code></a> is supposed to be a <a href="../sequence/concepts/random_access_sequence.html" title="Random
|
||||
only (<a href="../sequence/intrinsic/functions/at.html" title="at"><tt class="computeroutput"><span class="identifier">at</span></tt></a> is supposed to be a <a href="../sequence/concepts/random_access_sequence.html" title="Random
|
||||
Access Sequence">Random
|
||||
Access Sequence</a> requirement). The runtime complexity of <a href="../sequence/intrinsic/functions/at.html" title="at"><code class="computeroutput"><span class="identifier">at</span></code></a> is constant (see <a href="../notes.html#fusion.notes.recursive_inlined_functions">Recursive
|
||||
Access Sequence</a> requirement). The runtime complexity of <a href="../sequence/intrinsic/functions/at.html" title="at"><tt class="computeroutput"><span class="identifier">at</span></tt></a> is constant (see <a href="../notes.html#fusion.notes.recursive_inlined_functions">Recursive
|
||||
Inlined Functions</a>).
|
||||
</p></div>
|
||||
<a name="fusion.container.list.example"></a><h4>
|
||||
<a name="id1073605"></a>
|
||||
<a name="id484933"></a>
|
||||
<a href="list.html#fusion.container.list.example">Example</a>
|
||||
</h4>
|
||||
<pre class="programlisting"><span class="identifier">list</span><span class="special"><</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">float</span><span class="special">></span> <span class="identifier">l</span><span class="special">(</span><span class="number">12</span><span class="special">,</span> <span class="number">5.5f</span><span class="special">);</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <a href="../sequence/intrinsic/functions/at_c.html" title="at_c"><code class="computeroutput"><span class="identifier">at_c</span></code></a><span class="special"><</span><span class="number">0</span><span class="special">>(</span><span class="identifier">l</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <a href="../sequence/intrinsic/functions/at_c.html" title="at_c"><code class="computeroutput"><span class="identifier">at_c</span></code></a><span class="special"><</span><span class="number">1</span><span class="special">>(</span><span class="identifier">l</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <a href="../sequence/intrinsic/functions/at_c.html" title="at_c"><tt class="computeroutput"><span class="identifier">at_c</span></tt></a><span class="special"><</span><span class="number">0</span><span class="special">>(</span><span class="identifier">l</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <a href="../sequence/intrinsic/functions/at_c.html" title="at_c"><tt class="computeroutput"><span class="identifier">at_c</span></tt></a><span class="special"><</span><span class="number">1</span><span class="special">>(</span><span class="identifier">l</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
|
Reference in New Issue
Block a user