updates functional module: only two unfused variants, now

[SVN r51381]
This commit is contained in:
Tobias Schwinger
2009-02-22 06:27:12 +00:00
parent 2fdfd41b17
commit aaf89a67a6
263 changed files with 5823 additions and 7742 deletions

View File

@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title> The Full Extension Mechanism</title>
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
<link rel="start" href="../../index.html" title="Chapter<65>1.<2E>Fusion 2.0">
<link rel="up" href="../extension.html" title="Extension">
<link rel="prev" href="../extension.html" title="Extension">
@ -27,8 +27,8 @@
<a name="fusion.extension.ext_full"></a><a href="ext_full.html" title=" The Full Extension Mechanism"> The Full Extension Mechanism</a></h3></div></div></div>
<p>
The Fusion library is designed to be extensible, new sequences types can
easily be added. In fact, the library support for <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span></tt>,
<tt class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">array</span></tt> and <a href="http://www.boost.org/libs/mpl/index.html" target="_top">MPL</a>
easily be added. In fact, the library support for <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span></code>,
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">array</span></code> and <a href="http://www.boost.org/libs/mpl/index.html" target="_top">MPL</a>
sequences is entirely provided using the extension mechanism.
</p>
<p>
@ -48,15 +48,14 @@
</li>
</ol></div>
<a name="fusion.extension.ext_full.our_example"></a><h4>
<a name="id643992"></a>
<a name="id1256502"></a>
<a href="ext_full.html#fusion.extension.ext_full.our_example">Our example</a>
</h4>
<p>
In order to illustrate enabling a new sequence type for use with Fusion,
we are going to use the type:
</p>
<pre class="programlisting">
<span class="keyword">namespace</span> <span class="identifier">example</span>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">example</span>
<span class="special">{</span>
<span class="keyword">struct</span> <span class="identifier">example_struct</span>
<span class="special">{</span>
@ -73,14 +72,14 @@
<p>
We are going to pretend that this type has been provided by a 3rd party library,
and therefore cannot be modified. We shall work through all the necessary
steps to enable <tt class="computeroutput"><span class="identifier">example_struct</span></tt>
steps to enable <code class="computeroutput"><span class="identifier">example_struct</span></code>
to serve as an <a href="../sequence/concepts/associative_sequence.html" title="Associative
Sequence">Associative
Sequence</a> as described in the <a href="../quick_start.html" title="Quick Start">Quick
Start</a> guide.
</p>
<a name="fusion.extension.ext_full.enabling_tag_dispatching"></a><h4>
<a name="id644280"></a>
<a name="id1256758"></a>
<a href="ext_full.html#fusion.extension.ext_full.enabling_tag_dispatching">Enabling
Tag Dispatching</a>
</h4>
@ -90,19 +89,17 @@
type. In order to exploit the tag dispatching mechanism we must first declare
a new tag type for the mechanism to use. For example:
</p>
<pre class="programlisting">
<span class="keyword">namespace</span> <span class="identifier">example</span> <span class="special">{</span>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">example</span> <span class="special">{</span>
<span class="keyword">struct</span> <span class="identifier">example_sequence_tag</span><span class="special">;</span> <span class="comment">// Only definition needed
</span><span class="special">}</span>
</pre>
<p>
Next we need to enable the <tt class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">tag_of</span></tt>
Next we need to enable the <code class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">tag_of</span></code>
metafunction to return our newly chosen tag type for operations involving
our sequence. This is done by specializing <tt class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">tag_of</span></tt>
our sequence. This is done by specializing <code class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">tag_of</span></code>
for our sequence type.
</p>
<pre class="programlisting">
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">support</span><span class="special">/</span><span class="identifier">tag_of_fwd</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">support</span><span class="special">/</span><span class="identifier">tag_of_fwd</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</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">tag_of_fwd</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">fusion</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">traits</span> <span class="special">{</span>
@ -114,17 +111,16 @@
<span class="special">}}}</span>
</pre>
<p>
<tt class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">tag_of</span></tt> also has a second template argument,
that can be used in conjuction with <tt class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">enable_if</span></tt>
<code class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">tag_of</span></code> also has a second template argument,
that can be used in conjuction with <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">enable_if</span></code>
to provide tag support for groups of related types. This feature is not necessary
for our sequence, but for an example see the code in:
</p>
<pre class="programlisting">
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">adapted</span><span class="special">/</span><span class="identifier">array</span><span class="special">/</span><span class="identifier">tag_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">adapted</span><span class="special">/</span><span class="identifier">array</span><span class="special">/</span><span class="identifier">tag_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</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">tag_of</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<a name="fusion.extension.ext_full.designing_a_suitable_iterator"></a><h4>
<a name="id644907"></a>
<a name="id1257308"></a>
<a href="ext_full.html#fusion.extension.ext_full.designing_a_suitable_iterator">Designing
a suitable iterator</a>
</h4>
@ -134,12 +130,11 @@
a random access iterator in our example.
</p>
<p>
We will use a simple design, in which the 2 members of <tt class="computeroutput"><span class="identifier">example_struct</span></tt>
are given numbered indices, 0 for <tt class="computeroutput"><span class="identifier">name</span></tt>
and 1 for <tt class="computeroutput"><span class="identifier">age</span></tt> respectively.
We will use a simple design, in which the 2 members of <code class="computeroutput"><span class="identifier">example_struct</span></code>
are given numbered indices, 0 for <code class="computeroutput"><span class="identifier">name</span></code>
and 1 for <code class="computeroutput"><span class="identifier">age</span></code> respectively.
</p>
<pre class="programlisting">
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Struct</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">Pos</span><span class="special">&gt;</span>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Struct</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">Pos</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">example_struct_iterator</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">iterator_base</span><span class="special">&lt;</span><span class="identifier">example_struct_iterator</span><span class="special">&lt;</span><span class="identifier">Struct</span><span class="special">,</span> <span class="identifier">Pos</span><span class="special">&gt;</span> <span class="special">&gt;</span>
<span class="special">{</span>
@ -163,41 +158,40 @@
index of the current element.
</li>
<li>
The typedefs <tt class="computeroutput"><span class="identifier">struct_type</span></tt>
and <tt class="computeroutput"><span class="identifier">index</span></tt> provide convenient
The typedefs <code class="computeroutput"><span class="identifier">struct_type</span></code>
and <code class="computeroutput"><span class="identifier">index</span></code> provide convenient
access to information we will need later in the implementation.
</li>
<li>
The typedef <tt class="computeroutput"><span class="identifier">category</span></tt> allows
the <tt class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><a href="../support/category_of.html" title="category_of"><tt class="computeroutput"><span class="identifier">category_of</span></tt></a></tt>
The typedef <code class="computeroutput"><span class="identifier">category</span></code> allows
the <code class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><a href="../support/category_of.html" title="category_of"><code class="computeroutput"><span class="identifier">category_of</span></code></a></code>
metafunction to establish the traversal category of the iterator.
</li>
<li>
The constructor stores a reference to the <tt class="computeroutput"><span class="identifier">example_struct</span></tt>
The constructor stores a reference to the <code class="computeroutput"><span class="identifier">example_struct</span></code>
being iterated over.
</li>
</ol></div>
<p>
We also need to enable <a href="../notes.html#fusion.notes.tag_dispatching"><span class="emphasis"><em>tag
dispatching</em></span></a> for our iterator type, with another specialization
of <tt class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">tag_of</span></tt>.
of <code class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">tag_of</span></code>.
</p>
<p>
In isolation, the iterator implementation is pretty dry. Things should become
clearer as we add features to our implementation.
</p>
<a name="fusion.extension.ext_full.a_first_couple_of_instructive_features"></a><h4>
<a name="id645568"></a>
<a name="id1257892"></a>
<a href="ext_full.html#fusion.extension.ext_full.a_first_couple_of_instructive_features">A
first couple of instructive features</a>
</h4>
<p>
To start with, we will get the <a href="../iterator/metafunctions/value_of.html" title="value_of"><tt class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">value_of</span></tt></a> metafunction working. To
do this, we provide a specialization of the <tt class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">fusion</span><span class="special">::</span><span class="identifier">extension</span><span class="special">::</span><span class="identifier">value_of_impl</span></tt>
To start with, we will get the <a href="../iterator/metafunctions/value_of.html" title="value_of"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">value_of</span></code></a> metafunction working. To
do this, we provide a specialization of the <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">fusion</span><span class="special">::</span><span class="identifier">extension</span><span class="special">::</span><span class="identifier">value_of_impl</span></code>
template for our iterator's tag type.
</p>
<pre class="programlisting">
<span class="keyword">template</span><span class="special">&lt;&gt;</span>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;&gt;</span>
<span class="keyword">struct</span> <span class="identifier">value_of_impl</span><span class="special">&lt;</span><span class="identifier">example</span><span class="special">::</span><span class="identifier">example_struct_iterator_tag</span><span class="special">&gt;</span>
<span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">&gt;</span>
@ -218,22 +212,21 @@
</pre>
<p>
The implementation itself is pretty simple, it just uses 2 partial specializations
to provide the type of the 2 different members of <tt class="computeroutput"><span class="identifier">example_struct</span></tt>,
to provide the type of the 2 different members of <code class="computeroutput"><span class="identifier">example_struct</span></code>,
based on the index of the iterator.
</p>
<p>
To understand how <tt class="computeroutput"><span class="identifier">value_of_impl</span></tt>
is used by the library we will look at the implementation of <a href="../iterator/metafunctions/value_of.html" title="value_of"><tt class="computeroutput"><span class="identifier">value_of</span></tt></a>:
To understand how <code class="computeroutput"><span class="identifier">value_of_impl</span></code>
is used by the library we will look at the implementation of <a href="../iterator/metafunctions/value_of.html" title="value_of"><code class="computeroutput"><span class="identifier">value_of</span></code></a>:
</p>
<pre class="programlisting">
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <a href="../iterator/metafunctions/value_of.html" title="value_of"><tt class="computeroutput"><span class="identifier">value_of</span></tt></a>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <a href="../iterator/metafunctions/value_of.html" title="value_of"><code class="computeroutput"><span class="identifier">value_of</span></code></a>
<span class="special">:</span> <span class="identifier">extension</span><span class="special">::</span><span class="identifier">value_of_impl</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">detail</span><span class="special">::</span><span class="identifier">tag_of</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;::</span>
<span class="keyword">template</span> <span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">&gt;</span>
<span class="special">{};</span>
</pre>
<p>
So <a href="../iterator/metafunctions/value_of.html" title="value_of"><tt class="computeroutput"><span class="identifier">value_of</span></tt></a>
So <a href="../iterator/metafunctions/value_of.html" title="value_of"><code class="computeroutput"><span class="identifier">value_of</span></code></a>
uses <a href="../notes.html#fusion.notes.tag_dispatching"><span class="emphasis"><em>tag dispatching</em></span></a>
to select an <a href="http://www.boost.org/libs/mpl/doc/refmanual/metafunction-class.html" target="_top">MPL
Metafunction Class</a> to provide its functionality. You will notice
@ -241,10 +234,9 @@
</p>
<p>
Ok, lets enable dereferencing of our iterator. In this case we must provide
a suitable specialization of <tt class="computeroutput"><span class="identifier">deref_impl</span></tt>.
a suitable specialization of <code class="computeroutput"><span class="identifier">deref_impl</span></code>.
</p>
<pre class="programlisting">
<span class="keyword">template</span><span class="special">&lt;&gt;</span>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;&gt;</span>
<span class="keyword">struct</span> <span class="identifier">deref_impl</span><span class="special">&lt;</span><span class="identifier">example</span><span class="special">::</span><span class="identifier">example_struct_iterator_tag</span><span class="special">&gt;</span>
<span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">&gt;</span>
@ -279,17 +271,16 @@
<span class="special">}</span>
</pre>
<p>
The use of <tt class="computeroutput"><span class="identifier">deref_impl</span></tt> is
very similar to that of <tt class="computeroutput"><span class="identifier">value_of_impl</span></tt>,
but it also provides some runtime functionality this time via the <tt class="computeroutput"><span class="identifier">call</span></tt> static member function. To see how
<tt class="computeroutput"><span class="identifier">deref_impl</span></tt> is used, lets
have a look at the implementation of <a href="../iterator/functions/deref.html" title="deref"><tt class="computeroutput"><span class="identifier">deref</span></tt></a>:
The use of <code class="computeroutput"><span class="identifier">deref_impl</span></code> is
very similar to that of <code class="computeroutput"><span class="identifier">value_of_impl</span></code>,
but it also provides some runtime functionality this time via the <code class="computeroutput"><span class="identifier">call</span></code> static member function. To see how
<code class="computeroutput"><span class="identifier">deref_impl</span></code> is used, lets
have a look at the implementation of <a href="../iterator/functions/deref.html" title="deref"><code class="computeroutput"><span class="identifier">deref</span></code></a>:
</p>
<pre class="programlisting">
<span class="keyword">namespace</span> <span class="identifier">result_of</span>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">result_of</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <a href="../iterator/functions/deref.html" title="deref"><tt class="computeroutput"><span class="identifier">deref</span></tt></a>
<span class="keyword">struct</span> <a href="../iterator/functions/deref.html" title="deref"><code class="computeroutput"><span class="identifier">deref</span></code></a>
<span class="special">:</span> <span class="identifier">extension</span><span class="special">::</span><span class="identifier">deref_impl</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">detail</span><span class="special">::</span><span class="identifier">tag_of</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;::</span>
<span class="keyword">template</span> <span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">&gt;</span>
<span class="special">{};</span>
@ -297,24 +288,24 @@
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">&gt;</span>
<span class="keyword">typename</span> <span class="identifier">result_of</span><span class="special">::</span><span class="identifier">deref</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">&gt;::</span><span class="identifier">type</span>
<a href="../iterator/functions/deref.html" title="deref"><tt class="computeroutput"><span class="identifier">deref</span></tt></a><span class="special">(</span><span class="identifier">Iterator</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">i</span><span class="special">)</span>
<a href="../iterator/functions/deref.html" title="deref"><code class="computeroutput"><span class="identifier">deref</span></code></a><span class="special">(</span><span class="identifier">Iterator</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">i</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">typedef</span> <span class="identifier">result_of</span><span class="special">::</span><span class="identifier">deref</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">&gt;</span> <span class="identifier">deref_meta</span><span class="special">;</span>
<span class="keyword">return</span> <span class="identifier">deref_meta</span><span class="special">::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">i</span><span class="special">);</span>
<span class="special">}</span>
</pre>
<p>
So again <a href="../iterator/metafunctions/deref.html" title="deref"><tt class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">deref</span></tt></a> uses <a href="../notes.html#fusion.notes.tag_dispatching"><span class="emphasis"><em>tag
dispatching</em></span></a> in exactly the same way as the <a href="../iterator/metafunctions/value_of.html" title="value_of"><tt class="computeroutput"><span class="identifier">value_of</span></tt></a> implementation. The runtime
functionality used by <a href="../iterator/functions/deref.html" title="deref"><tt class="computeroutput"><span class="identifier">deref</span></tt></a> is provided by the <tt class="computeroutput"><span class="identifier">call</span></tt> static function of the selected <a href="http://www.boost.org/libs/mpl/doc/refmanual/metafunction-class.html" target="_top">MPL
So again <a href="../iterator/metafunctions/deref.html" title="deref"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">deref</span></code></a> uses <a href="../notes.html#fusion.notes.tag_dispatching"><span class="emphasis"><em>tag
dispatching</em></span></a> in exactly the same way as the <a href="../iterator/metafunctions/value_of.html" title="value_of"><code class="computeroutput"><span class="identifier">value_of</span></code></a> implementation. The runtime
functionality used by <a href="../iterator/functions/deref.html" title="deref"><code class="computeroutput"><span class="identifier">deref</span></code></a> is provided by the <code class="computeroutput"><span class="identifier">call</span></code> static function of the selected <a href="http://www.boost.org/libs/mpl/doc/refmanual/metafunction-class.html" target="_top">MPL
Metafunction Class</a>.
</p>
<p>
The actual implementation of <tt class="computeroutput"><span class="identifier">deref_impl</span></tt>
is slightly more complex than that of <tt class="computeroutput"><span class="identifier">value_of_impl</span></tt>.
We also need to implement the <tt class="computeroutput"><span class="identifier">call</span></tt>
The actual implementation of <code class="computeroutput"><span class="identifier">deref_impl</span></code>
is slightly more complex than that of <code class="computeroutput"><span class="identifier">value_of_impl</span></code>.
We also need to implement the <code class="computeroutput"><span class="identifier">call</span></code>
function, which returns a reference to the appropriate member of the underlying
sequence. We also require a little bit of metaprogramming to return <tt class="computeroutput"><span class="keyword">const</span></tt> references if the underlying sequence
sequence. We also require a little bit of metaprogramming to return <code class="computeroutput"><span class="keyword">const</span></code> references if the underlying sequence
is const.
</p>
<div class="note"><table border="0" summary="Note">
@ -322,26 +313,25 @@
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/html/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td colspan="2" align="left" valign="top"><p>
<tr><td align="left" valign="top"><p>
Although there is a fair amount of left to do to produce a fully fledged
Fusion sequence, <a href="../iterator/metafunctions/value_of.html" title="value_of"><tt class="computeroutput"><span class="identifier">value_of</span></tt></a> and <a href="../iterator/functions/deref.html" title="deref"><tt class="computeroutput"><span class="identifier">deref</span></tt></a> illustrate all the signficant
Fusion sequence, <a href="../iterator/metafunctions/value_of.html" title="value_of"><code class="computeroutput"><span class="identifier">value_of</span></code></a> and <a href="../iterator/functions/deref.html" title="deref"><code class="computeroutput"><span class="identifier">deref</span></code></a> illustrate all the signficant
concepts required. The remainder of the process is very repetitive, simply
requiring implementation of a suitable <tt class="computeroutput"><span class="identifier">xxxx_impl</span></tt>
for each feature <tt class="computeroutput"><span class="identifier">xxxx</span></tt>.
requiring implementation of a suitable <code class="computeroutput"><span class="identifier">xxxx_impl</span></code>
for each feature <code class="computeroutput"><span class="identifier">xxxx</span></code>.
</p></td></tr>
</table></div>
<a name="fusion.extension.ext_full.implementing_the_remaining_iterator_functionality"></a><h4>
<a name="id647880"></a>
<a name="id1277403"></a>
<a href="ext_full.html#fusion.extension.ext_full.implementing_the_remaining_iterator_functionality">Implementing
the remaining iterator functionality</a>
</h4>
<p>
Ok, now we have seen the way <a href="../iterator/metafunctions/value_of.html" title="value_of"><tt class="computeroutput"><span class="identifier">value_of</span></tt></a> and <a href="../iterator/functions/deref.html" title="deref"><tt class="computeroutput"><span class="identifier">deref</span></tt></a> work, everything else will
Ok, now we have seen the way <a href="../iterator/metafunctions/value_of.html" title="value_of"><code class="computeroutput"><span class="identifier">value_of</span></code></a> and <a href="../iterator/functions/deref.html" title="deref"><code class="computeroutput"><span class="identifier">deref</span></code></a> work, everything else will
work in pretty much the same way. Lets start with forward iteration, by providing
a <tt class="computeroutput"><span class="identifier">next_impl</span></tt>:
a <code class="computeroutput"><span class="identifier">next_impl</span></code>:
</p>
<pre class="programlisting">
<span class="keyword">template</span><span class="special">&lt;&gt;</span>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;&gt;</span>
<span class="keyword">struct</span> <span class="identifier">next_impl</span><span class="special">&lt;</span><span class="identifier">example</span><span class="special">::</span><span class="identifier">example_struct_iterator_tag</span><span class="special">&gt;</span>
<span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">&gt;</span>
@ -360,44 +350,43 @@
<span class="special">};</span>
</pre>
<p>
This should be very familiar from our <tt class="computeroutput"><span class="identifier">deref_impl</span></tt>
This should be very familiar from our <code class="computeroutput"><span class="identifier">deref_impl</span></code>
implementation, we will be using this approach again and again now. Our design
is simply to increment the <tt class="computeroutput"><span class="identifier">index</span></tt>
is simply to increment the <code class="computeroutput"><span class="identifier">index</span></code>
counter to move on to the next element. The various other iterator manipulations
we need to perform will all just involve simple calculations with the <tt class="computeroutput"><span class="identifier">index</span></tt> variables.
we need to perform will all just involve simple calculations with the <code class="computeroutput"><span class="identifier">index</span></code> variables.
</p>
<p>
We also need to provide a suitable <tt class="computeroutput"><span class="identifier">equal_to_impl</span></tt>
We also need to provide a suitable <code class="computeroutput"><span class="identifier">equal_to_impl</span></code>
so that iterators can be correctly compared. A <a href="../iterator/concepts/bidirectional_iterator.html" title="Bidirectional
Iterator">Bidirectional
Iterator</a> will also need an implementation of <tt class="computeroutput"><span class="identifier">prior_impl</span></tt>.
Iterator</a> will also need an implementation of <code class="computeroutput"><span class="identifier">prior_impl</span></code>.
For a <a href="../iterator/concepts/random_access_iterator.html" title="Random
Access Iterator">Random
Access Iterator</a> <tt class="computeroutput"><span class="identifier">distance_impl</span></tt>
and <tt class="computeroutput"><span class="identifier">advance_impl</span></tt> also need
Access Iterator</a> <code class="computeroutput"><span class="identifier">distance_impl</span></code>
and <code class="computeroutput"><span class="identifier">advance_impl</span></code> also need
to be provided in order to satisfy the necessary complexity guarantees. As
our iterator is a <a href="../iterator/concepts/random_access_iterator.html" title="Random
Access Iterator">Random
Access Iterator</a> we will have to implement all of these functions.
</p>
<p>
Full implementations of <tt class="computeroutput"><span class="identifier">prior_impl</span></tt>,
<tt class="computeroutput"><span class="identifier">advance_impl</span></tt>, <tt class="computeroutput"><span class="identifier">distance_impl</span></tt> and <tt class="computeroutput"><span class="identifier">equal_to_impl</span></tt>
Full implementations of <code class="computeroutput"><span class="identifier">prior_impl</span></code>,
<code class="computeroutput"><span class="identifier">advance_impl</span></code>, <code class="computeroutput"><span class="identifier">distance_impl</span></code> and <code class="computeroutput"><span class="identifier">equal_to_impl</span></code>
are provided in the example code.
</p>
<a name="fusion.extension.ext_full.implementing_the_intrinsic_functions_of_the_sequence"></a><h4>
<a name="id648532"></a>
<a name="id1277977"></a>
<a href="ext_full.html#fusion.extension.ext_full.implementing_the_intrinsic_functions_of_the_sequence">Implementing
the intrinsic functions of the sequence</a>
</h4>
<p>
In order that Fusion can correctly identify our sequence as a Fusion sequence,
we need to enable <tt class="computeroutput"><span class="identifier">is_sequence</span></tt>
for our sequence type. As usual we just create an <tt class="computeroutput"><span class="identifier">impl</span></tt>
we need to enable <code class="computeroutput"><span class="identifier">is_sequence</span></code>
for our sequence type. As usual we just create an <code class="computeroutput"><span class="identifier">impl</span></code>
type specialized for our sequence tag:
</p>
<pre class="programlisting">
<span class="keyword">template</span><span class="special">&lt;&gt;</span>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;&gt;</span>
<span class="keyword">struct</span> <span class="identifier">is_sequence_impl</span><span class="special">&lt;</span><span class="identifier">example</span><span class="special">::</span><span class="identifier">example_sequence_tag</span><span class="special">&gt;</span>
<span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">&gt;</span>
@ -405,18 +394,17 @@
<span class="special">};</span>
</pre>
<p>
We've some similar formalities to complete, providing <tt class="computeroutput"><span class="identifier">category_of_impl</span></tt>
so Fusion can correctly identify our sequence type, and <tt class="computeroutput"><span class="identifier">is_view_impl</span></tt>
We've some similar formalities to complete, providing <code class="computeroutput"><span class="identifier">category_of_impl</span></code>
so Fusion can correctly identify our sequence type, and <code class="computeroutput"><span class="identifier">is_view_impl</span></code>
so Fusion can correctly identify our sequence as not being a <a href="../view.html" title="View">View</a>
type. Implementations are provide in the example code.
</p>
<p>
Now we've completed some formalities, on to more interesting features. Lets
get <a href="../sequence/intrinsic/functions/begin.html" title="begin"><tt class="computeroutput"><span class="identifier">begin</span></tt></a> working so that we can get
get <a href="../sequence/intrinsic/functions/begin.html" title="begin"><code class="computeroutput"><span class="identifier">begin</span></code></a> working so that we can get
an iterator to start accessing the data in our sequence.
</p>
<pre class="programlisting">
<span class="keyword">template</span><span class="special">&lt;&gt;</span>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;&gt;</span>
<span class="keyword">struct</span> <span class="identifier">begin_impl</span><span class="special">&lt;</span><span class="identifier">example</span><span class="special">::</span><span class="identifier">example_sequence_tag</span><span class="special">&gt;</span>
<span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Sequence</span><span class="special">&gt;</span>
@ -435,37 +423,36 @@
<p>
The implementation uses the same ideas we have applied throughout, in this
case we are just creating one of the iterators we developed earlier, pointing
to the first element in the sequence. The implementation of <a href="../sequence/intrinsic/functions/end.html" title="end"><tt class="computeroutput"><span class="identifier">end</span></tt></a> is very similar, and is provided
to the first element in the sequence. The implementation of <a href="../sequence/intrinsic/functions/end.html" title="end"><code class="computeroutput"><span class="identifier">end</span></code></a> is very similar, and is provided
in the example code.
</p>
<p>
For our <a href="../sequence/concepts/random_access_sequence.html" title="Random
Access Sequence">Random
Access Sequence</a> we will also need to implement <tt class="computeroutput"><span class="identifier">size_impl</span></tt>,
<tt class="computeroutput"><span class="identifier">value_at_impl</span></tt> and <tt class="computeroutput"><span class="identifier">at_impl</span></tt>.
Access Sequence</a> we will also need to implement <code class="computeroutput"><span class="identifier">size_impl</span></code>,
<code class="computeroutput"><span class="identifier">value_at_impl</span></code> and <code class="computeroutput"><span class="identifier">at_impl</span></code>.
</p>
<a name="fusion.extension.ext_full.enabling_our_type_as_an_associative_container"></a><h4>
<a name="id649140"></a>
<a name="id1278512"></a>
<a href="ext_full.html#fusion.extension.ext_full.enabling_our_type_as_an_associative_container">Enabling
our type as an associative container</a>
</h4>
<p>
In order for <tt class="computeroutput"><span class="identifier">example_struct</span></tt>
In order for <code class="computeroutput"><span class="identifier">example_struct</span></code>
to serve as an associative container, we need to enable 3 lookup features,
<a href="../sequence/intrinsic/functions/at_key.html" title="at_key"><tt class="computeroutput"><span class="identifier">at_key</span></tt></a>, <a href="../sequence/intrinsic/metafunctions/value_at_key.html" title="value_at_key"><tt class="computeroutput"><span class="identifier">value_at_key</span></tt></a> and <a href="../sequence/intrinsic/functions/has_key.html" title="has_key"><tt class="computeroutput"><span class="identifier">has_key</span></tt></a>. We also need to provide
an implementation of the <tt class="computeroutput"><span class="identifier">is_associative</span></tt>
<a href="../sequence/intrinsic/functions/at_key.html" title="at_key"><code class="computeroutput"><span class="identifier">at_key</span></code></a>, <a href="../sequence/intrinsic/metafunctions/value_at_key.html" title="value_at_key"><code class="computeroutput"><span class="identifier">value_at_key</span></code></a> and <a href="../sequence/intrinsic/functions/has_key.html" title="has_key"><code class="computeroutput"><span class="identifier">has_key</span></code></a>. We also need to provide
an implementation of the <code class="computeroutput"><span class="identifier">is_associative</span></code>
trait so that our sequence can be correctly identified as an associative
container.
</p>
<p>
To implement <tt class="computeroutput"><span class="identifier">at_key_impl</span></tt>
we need to associate the <tt class="computeroutput"><span class="identifier">fields</span><span class="special">::</span><span class="identifier">age</span></tt> and
<tt class="computeroutput"><span class="identifier">fields</span><span class="special">::</span><span class="identifier">age</span></tt> types described in the <a href="../quick_start.html" title="Quick Start">Quick
Start</a> guide with the appropriate members of <tt class="computeroutput"><span class="identifier">example_struct</span></tt>.
To implement <code class="computeroutput"><span class="identifier">at_key_impl</span></code>
we need to associate the <code class="computeroutput"><span class="identifier">fields</span><span class="special">::</span><span class="identifier">age</span></code> and
<code class="computeroutput"><span class="identifier">fields</span><span class="special">::</span><span class="identifier">age</span></code> types described in the <a href="../quick_start.html" title="Quick Start">Quick
Start</a> guide with the appropriate members of <code class="computeroutput"><span class="identifier">example_struct</span></code>.
Our implementation is as follows:
</p>
<pre class="programlisting">
<span class="keyword">template</span><span class="special">&lt;&gt;</span>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;&gt;</span>
<span class="keyword">struct</span> <span class="identifier">at_key_impl</span><span class="special">&lt;</span><span class="identifier">example</span><span class="special">::</span><span class="identifier">example_sequence_tag</span><span class="special">&gt;</span>
<span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Sequence</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Key</span><span class="special">&gt;</span>
@ -504,16 +491,16 @@
</pre>
<p>
Its all very similar to the implementations we've seen previously, such as
<tt class="computeroutput"><span class="identifier">deref_impl</span></tt> and <tt class="computeroutput"><span class="identifier">value_of_impl</span></tt>. Instead of identifying the
<code class="computeroutput"><span class="identifier">deref_impl</span></code> and <code class="computeroutput"><span class="identifier">value_of_impl</span></code>. Instead of identifying the
members by index or position, we are now selecting them using the types
<tt class="computeroutput"><span class="identifier">fields</span><span class="special">::</span><span class="identifier">name</span></tt> and <tt class="computeroutput"><span class="identifier">fields</span><span class="special">::</span><span class="identifier">age</span></tt>.
The implementations of <tt class="computeroutput"><span class="identifier">value_at_key_impl</span></tt>
and <tt class="computeroutput"><span class="identifier">has_key_impl</span></tt> are equally
<code class="computeroutput"><span class="identifier">fields</span><span class="special">::</span><span class="identifier">name</span></code> and <code class="computeroutput"><span class="identifier">fields</span><span class="special">::</span><span class="identifier">age</span></code>.
The implementations of <code class="computeroutput"><span class="identifier">value_at_key_impl</span></code>
and <code class="computeroutput"><span class="identifier">has_key_impl</span></code> are equally
straightforward, and are provided in the example code, along with an implementation
of <tt class="computeroutput"><span class="identifier">is_associative_impl</span></tt>.
of <code class="computeroutput"><span class="identifier">is_associative_impl</span></code>.
</p>
<a name="fusion.extension.ext_full.summary"></a><h4>
<a name="id650149"></a>
<a name="id1279401"></a>
<a href="ext_full.html#fusion.extension.ext_full.summary">Summary</a>
</h4>
<p>
@ -523,8 +510,8 @@
pattern.
</p>
<p>
The support for <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span></tt>, <a href="http://www.boost.org/libs/mpl/index.html" target="_top">MPL</a>
sequences, and <tt class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">array</span></tt> all use the same approach, and provide
The support for <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span></code>, <a href="http://www.boost.org/libs/mpl/index.html" target="_top">MPL</a>
sequences, and <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">array</span></code> all use the same approach, and provide
additional examples of the approach for a variety of types.
</p>
</div>

View File

@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Iterator Facade</title>
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
<link rel="start" href="../../index.html" title="Chapter<65>1.<2E>Fusion 2.0">
<link rel="up" href="../extension.html" title="Extension">
<link rel="prev" href="sequence_facade.html" title="Sequence Facade">
@ -26,24 +26,23 @@
<div class="titlepage"><div><div><h3 class="title">
<a name="fusion.extension.iterator_facade"></a><a href="iterator_facade.html" title="Iterator Facade">Iterator Facade</a></h3></div></div></div>
<a name="fusion.extension.iterator_facade.description"></a><h4>
<a name="id651772"></a>
<a name="id1280834"></a>
<a href="iterator_facade.html#fusion.extension.iterator_facade.description">Description</a>
</h4>
<p>
The <a href="iterator_facade.html" title="Iterator Facade"><tt class="computeroutput"><span class="identifier">iterator_facade</span></tt></a>
The <a href="iterator_facade.html" title="Iterator Facade"><code class="computeroutput"><span class="identifier">iterator_facade</span></code></a>
template provides an intrusive mechanism for producing a conforming Fusion
iterator.
</p>
<a name="fusion.extension.iterator_facade.synopsis"></a><h4>
<a name="id651821"></a>
<a name="id1280877"></a>
<a href="iterator_facade.html#fusion.extension.iterator_facade.synopsis">Synopsis</a>
</h4>
<pre class="programlisting">
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Derived</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">TravesalTag</span><span class="special">&gt;</span>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Derived</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">TravesalTag</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">iterator_facade</span><span class="special">;</span>
</pre>
<a name="fusion.extension.iterator_facade.usage"></a><h4>
<a name="id651916"></a>
<a name="id1280961"></a>
<a href="iterator_facade.html#fusion.extension.iterator_facade.usage">Usage</a>
</h4>
<p>
@ -57,7 +56,7 @@
type.
</p>
<div class="table">
<a name="id651942"></a><p class="title"><b>Table<EFBFBD>1.93.<2E>Parameters</b></p>
<a name="id1280989"></a><p class="title"><b>Table<EFBFBD>1.93.<2E>Parameters</b></p>
<table class="table" summary="Parameters">
<colgroup>
<col>
@ -79,20 +78,20 @@
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">iterator</span></tt>, <tt class="computeroutput"><span class="identifier">It</span></tt>, <tt class="computeroutput"><span class="identifier">It1</span></tt>,
<tt class="computeroutput"><span class="identifier">It2</span></tt>
<code class="computeroutput"><span class="identifier">iterator</span></code>, <code class="computeroutput"><span class="identifier">It</span></code>, <code class="computeroutput"><span class="identifier">It1</span></code>,
<code class="computeroutput"><span class="identifier">It2</span></code>
</p>
</td>
<td>
<p>
A type derived from <a href="iterator_facade.html" title="Iterator Facade"><tt class="computeroutput"><span class="identifier">iterator_facade</span></tt></a>
A type derived from <a href="iterator_facade.html" title="Iterator Facade"><code class="computeroutput"><span class="identifier">iterator_facade</span></code></a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">N</span></tt>
<code class="computeroutput"><span class="identifier">N</span></code>
</p>
</td>
<td>
@ -106,7 +105,7 @@
</table>
</div>
<div class="table">
<a name="id652100"></a><p class="title"><b>Table<EFBFBD>1.94.<2E>Key Expressions</b></p>
<a name="id1281129"></a><p class="title"><b>Table<EFBFBD>1.94.<2E>Key Expressions</b></p>
<table class="table" summary="Key Expressions">
<colgroup>
<col>
@ -134,12 +133,12 @@
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">value_of</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">type</span></tt>
<code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">value_of</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
<td>
<p>
The element stored at iterator position <tt class="computeroutput"><span class="identifier">It</span></tt>
The element stored at iterator position <code class="computeroutput"><span class="identifier">It</span></code>
</p>
</td>
<td>
@ -151,12 +150,12 @@
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">deref</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">type</span></tt>
<code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">deref</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
<td>
<p>
The type returned when dereferencing an iterator of type <tt class="computeroutput"><span class="identifier">It</span></tt>
The type returned when dereferencing an iterator of type <code class="computeroutput"><span class="identifier">It</span></code>
</p>
</td>
<td>
@ -168,12 +167,12 @@
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">deref</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">it</span><span class="special">)</span></tt>
<code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">deref</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">it</span><span class="special">)</span></code>
</p>
</td>
<td>
<p>
Dereferences iterator <tt class="computeroutput"><span class="identifier">it</span></tt>
Dereferences iterator <code class="computeroutput"><span class="identifier">it</span></code>
</p>
</td>
<td>
@ -185,12 +184,12 @@
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">next</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">type</span></tt>
<code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">next</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
<td>
<p>
The type of the next element from <tt class="computeroutput"><span class="identifier">It</span></tt>
The type of the next element from <code class="computeroutput"><span class="identifier">It</span></code>
</p>
</td>
<td>
@ -202,12 +201,12 @@
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">next</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">it</span><span class="special">)</span></tt>
<code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">next</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">it</span><span class="special">)</span></code>
</p>
</td>
<td>
<p>
The next iterator after <tt class="computeroutput"><span class="identifier">it</span></tt>
The next iterator after <code class="computeroutput"><span class="identifier">it</span></code>
</p>
</td>
<td>
@ -219,12 +218,12 @@
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">prior</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">type</span></tt>
<code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">prior</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
<td>
<p>
The type of the next element from <tt class="computeroutput"><span class="identifier">It</span></tt>
The type of the next element from <code class="computeroutput"><span class="identifier">It</span></code>
</p>
</td>
<td>
@ -236,12 +235,12 @@
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">prior</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">it</span><span class="special">)</span></tt>
<code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">prior</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">it</span><span class="special">)</span></code>
</p>
</td>
<td>
<p>
The next iterator after <tt class="computeroutput"><span class="identifier">it</span></tt>
The next iterator after <code class="computeroutput"><span class="identifier">it</span></code>
</p>
</td>
<td>
@ -253,51 +252,51 @@
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">advance</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">,</span> <span class="identifier">N</span><span class="special">&gt;::</span><span class="identifier">type</span></tt>
<code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">advance</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">,</span> <span class="identifier">N</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
<td>
<p>
The type of an iterator advanced <tt class="computeroutput"><span class="identifier">N</span></tt>
elements from <tt class="computeroutput"><span class="identifier">It</span></tt>
The type of an iterator advanced <code class="computeroutput"><span class="identifier">N</span></code>
elements from <code class="computeroutput"><span class="identifier">It</span></code>
</p>
</td>
<td>
<p>
Implemented in terms of <tt class="computeroutput"><span class="identifier">next</span></tt>
and <tt class="computeroutput"><span class="identifier">prior</span></tt>
Implemented in terms of <code class="computeroutput"><span class="identifier">next</span></code>
and <code class="computeroutput"><span class="identifier">prior</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">advance</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">,</span> <span class="identifier">N</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">it</span><span class="special">)</span></tt>
<code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">advance</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">,</span> <span class="identifier">N</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">it</span><span class="special">)</span></code>
</p>
</td>
<td>
<p>
An iterator advanced <tt class="computeroutput"><span class="identifier">N</span></tt>
elements from <tt class="computeroutput"><span class="identifier">it</span></tt>
An iterator advanced <code class="computeroutput"><span class="identifier">N</span></code>
elements from <code class="computeroutput"><span class="identifier">it</span></code>
</p>
</td>
<td>
<p>
Implemented in terms of <tt class="computeroutput"><span class="identifier">next</span></tt>
and <tt class="computeroutput"><span class="identifier">prior</span></tt>
Implemented in terms of <code class="computeroutput"><span class="identifier">next</span></code>
and <code class="computeroutput"><span class="identifier">prior</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">distance</span><span class="special">&lt;</span><span class="identifier">It1</span><span class="special">,</span> <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">type</span></tt>
<code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">distance</span><span class="special">&lt;</span><span class="identifier">It1</span><span class="special">,</span> <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
<td>
<p>
The distance between iterators of type <tt class="computeroutput"><span class="identifier">It1</span></tt>
and <tt class="computeroutput"><span class="identifier">It2</span></tt> as an <a href="http://www.boost.org/libs/mpl/doc/refmanual/integral-constant.html" target="_top">MPL
The distance between iterators of type <code class="computeroutput"><span class="identifier">It1</span></code>
and <code class="computeroutput"><span class="identifier">It2</span></code> as an <a href="http://www.boost.org/libs/mpl/doc/refmanual/integral-constant.html" target="_top">MPL
Integral Constant</a>
</p>
</td>
@ -310,13 +309,13 @@
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">distance</span><span class="special">&lt;</span><span class="identifier">It1</span><span class="special">,</span> <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">it1</span><span class="special">,</span> <span class="identifier">it2</span><span class="special">)</span></tt>
<code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">distance</span><span class="special">&lt;</span><span class="identifier">It1</span><span class="special">,</span> <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">it1</span><span class="special">,</span> <span class="identifier">it2</span><span class="special">)</span></code>
</p>
</td>
<td>
<p>
The distance between iterator <tt class="computeroutput"><span class="identifier">it1</span></tt>
and <tt class="computeroutput"><span class="identifier">it2</span></tt>
The distance between iterator <code class="computeroutput"><span class="identifier">it1</span></code>
and <code class="computeroutput"><span class="identifier">it2</span></code>
</p>
</td>
<td>
@ -328,36 +327,36 @@
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">equal_to</span><span class="special">&lt;</span><span class="identifier">It1</span><span class="special">,</span> <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">type</span></tt>
<code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">equal_to</span><span class="special">&lt;</span><span class="identifier">It1</span><span class="special">,</span> <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
<td>
<p>
The distance between iterators of type <tt class="computeroutput"><span class="identifier">It1</span></tt>
and <tt class="computeroutput"><span class="identifier">It2</span></tt>
The distance between iterators of type <code class="computeroutput"><span class="identifier">It1</span></code>
and <code class="computeroutput"><span class="identifier">It2</span></code>
</p>
</td>
<td>
<p>
<tt class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">same_type</span><span class="special">&lt;</span><span class="identifier">It1</span><span class="special">,</span> <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">type</span></tt>
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">same_type</span><span class="special">&lt;</span><span class="identifier">It1</span><span class="special">,</span> <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">equal_to</span><span class="special">&lt;</span><span class="identifier">It1</span><span class="special">,</span> <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">it1</span><span class="special">,</span> <span class="identifier">it2</span><span class="special">)</span></tt>
<code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">equal_to</span><span class="special">&lt;</span><span class="identifier">It1</span><span class="special">,</span> <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">it1</span><span class="special">,</span> <span class="identifier">it2</span><span class="special">)</span></code>
</p>
</td>
<td>
<p>
The distance between iterators <tt class="computeroutput"><span class="identifier">it1</span></tt>
and <tt class="computeroutput"><span class="identifier">it2</span></tt>
The distance between iterators <code class="computeroutput"><span class="identifier">it1</span></code>
and <code class="computeroutput"><span class="identifier">it2</span></code>
</p>
</td>
<td>
<p>
<tt class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">same_type</span><span class="special">&lt;</span><span class="identifier">It1</span><span class="special">,</span> <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">()</span></tt>
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">same_type</span><span class="special">&lt;</span><span class="identifier">It1</span><span class="special">,</span> <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">()</span></code>
</p>
</td>
</tr>
@ -365,19 +364,18 @@
</table>
</div>
<a name="fusion.extension.iterator_facade.header"></a><h4>
<a name="id653659"></a>
<a name="id1282506"></a>
<a href="iterator_facade.html#fusion.extension.iterator_facade.header">Header</a>
</h4>
<pre class="programlisting">
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">iterator</span><span class="special">/</span><span class="identifier">iterator_facade</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">iterator</span><span class="special">/</span><span class="identifier">iterator_facade</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</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">iterator_facade</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<a name="fusion.extension.iterator_facade.example"></a><h4>
<a name="id653819"></a>
<a name="id1282645"></a>
<a href="iterator_facade.html#fusion.extension.iterator_facade.example">Example</a>
</h4>
<p>
A full working example using <a href="iterator_facade.html" title="Iterator Facade"><tt class="computeroutput"><span class="identifier">iterator_facade</span></tt></a> is provided in triple.cpp
A full working example using <a href="iterator_facade.html" title="Iterator Facade"><code class="computeroutput"><span class="identifier">iterator_facade</span></code></a> is provided in triple.cpp
in the extension examples.
</p>
</div>

View File

@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Sequence Facade</title>
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
<link rel="start" href="../../index.html" title="Chapter<65>1.<2E>Fusion 2.0">
<link rel="up" href="../extension.html" title="Extension">
<link rel="prev" href="ext_full.html" title=" The Full Extension Mechanism">
@ -26,32 +26,31 @@
<div class="titlepage"><div><div><h3 class="title">
<a name="fusion.extension.sequence_facade"></a><a href="sequence_facade.html" title="Sequence Facade">Sequence Facade</a></h3></div></div></div>
<a name="fusion.extension.sequence_facade.description"></a><h4>
<a name="id650260"></a>
<a name="id1279499"></a>
<a href="sequence_facade.html#fusion.extension.sequence_facade.description">Description</a>
</h4>
<p>
The <a href="sequence_facade.html" title="Sequence Facade"><tt class="computeroutput"><span class="identifier">sequence_facade</span></tt></a>
The <a href="sequence_facade.html" title="Sequence Facade"><code class="computeroutput"><span class="identifier">sequence_facade</span></code></a>
template provides an intrusive mechanism for producing a conforming Fusion
iterator.
</p>
<a name="fusion.extension.sequence_facade.synopsis"></a><h4>
<a name="id650309"></a>
<a name="id1279542"></a>
<a href="sequence_facade.html#fusion.extension.sequence_facade.synopsis">Synopsis</a>
</h4>
<pre class="programlisting">
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Derived</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">TravesalTag</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IsView</span> <span class="special">=</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">false_</span><span class="special">&gt;</span>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Derived</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">TravesalTag</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IsView</span> <span class="special">=</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">false_</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">sequence_facade</span><span class="special">;</span>
</pre>
<a name="fusion.extension.sequence_facade.usage"></a><h4>
<a name="id650444"></a>
<a name="id1279661"></a>
<a href="sequence_facade.html#fusion.extension.sequence_facade.usage">Usage</a>
</h4>
<p>
The user of <a href="sequence_facade.html" title="Sequence Facade"><tt class="computeroutput"><span class="identifier">sequence_facade</span></tt></a> derives his sequence
type from a specialization of <a href="sequence_facade.html" title="Sequence Facade"><tt class="computeroutput"><span class="identifier">sequence_facade</span></tt></a> and passes the derived
The user of <a href="sequence_facade.html" title="Sequence Facade"><code class="computeroutput"><span class="identifier">sequence_facade</span></code></a> derives his sequence
type from a specialization of <a href="sequence_facade.html" title="Sequence Facade"><code class="computeroutput"><span class="identifier">sequence_facade</span></code></a> and passes the derived
sequence type as the first template parameter. The second template parameter
should be the traversal category of the sequence being implemented. The 3rd
parameter should be set to <tt class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span></tt>
parameter should be set to <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span></code>
if the sequence is a view.
</p>
<p>
@ -59,7 +58,7 @@
type.
</p>
<div class="table">
<a name="id650532"></a><p class="title"><b>Table<EFBFBD>1.91.<2E>Parameters</b></p>
<a name="id1279740"></a><p class="title"><b>Table<EFBFBD>1.91.<2E>Parameters</b></p>
<table class="table" summary="Parameters">
<colgroup>
<col>
@ -81,19 +80,19 @@
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">sequence</span></tt>, <tt class="computeroutput"><span class="identifier">Seq</span></tt>
<code class="computeroutput"><span class="identifier">sequence</span></code>, <code class="computeroutput"><span class="identifier">Seq</span></code>
</p>
</td>
<td>
<p>
A type derived from <a href="sequence_facade.html" title="Sequence Facade"><tt class="computeroutput"><span class="identifier">sequence_facade</span></tt></a>
A type derived from <a href="sequence_facade.html" title="Sequence Facade"><code class="computeroutput"><span class="identifier">sequence_facade</span></code></a>
</p>
</td>
</tr>
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">N</span></tt>
<code class="computeroutput"><span class="identifier">N</span></code>
</p>
</td>
<td>
@ -107,7 +106,7 @@
</table>
</div>
<div class="table">
<a name="id650666"></a><p class="title"><b>Table<EFBFBD>1.92.<2E>Key Expressions</b></p>
<a name="id1279860"></a><p class="title"><b>Table<EFBFBD>1.92.<2E>Key Expressions</b></p>
<table class="table" summary="Key Expressions">
<colgroup>
<col>
@ -129,60 +128,60 @@
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">begin</span><span class="special">&lt;</span><span class="identifier">Seq</span><span class="special">&gt;::</span><span class="identifier">type</span></tt>
<code class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">begin</span><span class="special">&lt;</span><span class="identifier">Seq</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
<td>
<p>
The type of an iterator to the beginning of a sequence of type <tt class="computeroutput"><span class="identifier">Seq</span></tt>
The type of an iterator to the beginning of a sequence of type <code class="computeroutput"><span class="identifier">Seq</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">begin</span><span class="special">&lt;</span><span class="identifier">Seq</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">seq</span><span class="special">)</span></tt>
<code class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">begin</span><span class="special">&lt;</span><span class="identifier">Seq</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">seq</span><span class="special">)</span></code>
</p>
</td>
<td>
<p>
An iterator to the beginning of sequence <tt class="computeroutput"><span class="identifier">seq</span></tt>
An iterator to the beginning of sequence <code class="computeroutput"><span class="identifier">seq</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">end</span><span class="special">&lt;</span><span class="identifier">Seq</span><span class="special">&gt;::</span><span class="identifier">type</span></tt>
<code class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">end</span><span class="special">&lt;</span><span class="identifier">Seq</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
<td>
<p>
The type of an iterator to the end of a sequence of type <tt class="computeroutput"><span class="identifier">Seq</span></tt>
The type of an iterator to the end of a sequence of type <code class="computeroutput"><span class="identifier">Seq</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">end</span><span class="special">&lt;</span><span class="identifier">Seq</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">seq</span><span class="special">)</span></tt>
<code class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">end</span><span class="special">&lt;</span><span class="identifier">Seq</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">seq</span><span class="special">)</span></code>
</p>
</td>
<td>
<p>
An iterator to the end of sequence <tt class="computeroutput"><span class="identifier">seq</span></tt>
An iterator to the end of sequence <code class="computeroutput"><span class="identifier">seq</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">size</span><span class="special">&lt;</span><span class="identifier">Seq</span><span class="special">&gt;::</span><span class="identifier">type</span></tt>
<code class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">size</span><span class="special">&lt;</span><span class="identifier">Seq</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
<td>
<p>
The size of a sequence of type <tt class="computeroutput"><span class="identifier">Seq</span></tt>
The size of a sequence of type <code class="computeroutput"><span class="identifier">Seq</span></code>
as an <a href="http://www.boost.org/libs/mpl/doc/refmanual/integral-constant.html" target="_top">MPL
Integral Constant</a>
</p>
@ -191,51 +190,51 @@
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">size</span><span class="special">&lt;</span><span class="identifier">Seq</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">seq</span><span class="special">)</span></tt>
<code class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">size</span><span class="special">&lt;</span><span class="identifier">Seq</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">seq</span><span class="special">)</span></code>
</p>
</td>
<td>
<p>
The size of sequence <tt class="computeroutput"><span class="identifier">seq</span></tt>
The size of sequence <code class="computeroutput"><span class="identifier">seq</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">at</span><span class="special">&lt;</span><span class="identifier">Seq</span><span class="special">,</span> <span class="identifier">N</span><span class="special">&gt;::</span><span class="identifier">type</span></tt>
<code class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">at</span><span class="special">&lt;</span><span class="identifier">Seq</span><span class="special">,</span> <span class="identifier">N</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
<td>
<p>
The type of element <tt class="computeroutput"><span class="identifier">N</span></tt>
in a sequence of type <tt class="computeroutput"><span class="identifier">Seq</span></tt>
The type of element <code class="computeroutput"><span class="identifier">N</span></code>
in a sequence of type <code class="computeroutput"><span class="identifier">Seq</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">at</span><span class="special">&lt;</span><span class="identifier">Seq</span><span class="special">,</span> <span class="identifier">N</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">seq</span><span class="special">)</span></tt>
<code class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">at</span><span class="special">&lt;</span><span class="identifier">Seq</span><span class="special">,</span> <span class="identifier">N</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">seq</span><span class="special">)</span></code>
</p>
</td>
<td>
<p>
Element <tt class="computeroutput"><span class="identifier">N</span></tt> in sequence
<tt class="computeroutput"><span class="identifier">seq</span></tt>
Element <code class="computeroutput"><span class="identifier">N</span></code> in sequence
<code class="computeroutput"><span class="identifier">seq</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
<tt class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">value_at</span><span class="special">&lt;</span><span class="identifier">Sequence</span><span class="special">,</span> <span class="identifier">N</span><span class="special">&gt;::</span><span class="identifier">type</span></tt>
<code class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">value_at</span><span class="special">&lt;</span><span class="identifier">Sequence</span><span class="special">,</span> <span class="identifier">N</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
<td>
<p>
The type of the <tt class="computeroutput"><span class="identifier">N</span></tt>th
element in a sequence of type <tt class="computeroutput"><span class="identifier">Seq</span></tt>
The type of the <code class="computeroutput"><span class="identifier">N</span></code>th
element in a sequence of type <code class="computeroutput"><span class="identifier">Seq</span></code>
</p>
</td>
</tr>
@ -243,19 +242,18 @@
</table>
</div>
<a name="fusion.extension.sequence_facade.include"></a><h4>
<a name="id651546"></a>
<a name="id1280636"></a>
<a href="sequence_facade.html#fusion.extension.sequence_facade.include">Include</a>
</h4>
<pre class="programlisting">
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">sequence</span><span class="special">/</span><span class="identifier">sequence_facade</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">sequence</span><span class="special">/</span><span class="identifier">sequence_facade</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</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">sequence_facade</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<a name="fusion.extension.sequence_facade.example"></a><h4>
<a name="id651705"></a>
<a name="id1280774"></a>
<a href="sequence_facade.html#fusion.extension.sequence_facade.example">Example</a>
</h4>
<p>
A full working example using <a href="sequence_facade.html" title="Sequence Facade"><tt class="computeroutput"><span class="identifier">sequence_facade</span></tt></a> is provided in triple.cpp
A full working example using <a href="sequence_facade.html" title="Sequence Facade"><code class="computeroutput"><span class="identifier">sequence_facade</span></code></a> is provided in triple.cpp
in the extension examples.
</p>
</div>