• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Sequence Facade</title>
5<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../index.html" title="Chapter 1. Fusion 2.2">
8<link rel="up" href="../extension.html" title="Extension">
9<link rel="prev" href="ext_full.html" title="The Full Extension Mechanism">
10<link rel="next" href="iterator_facade.html" title="Iterator Facade">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="ext_full.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../extension.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="iterator_facade.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h3 class="title">
27<a name="fusion.extension.sequence_facade"></a><a class="link" href="sequence_facade.html" title="Sequence Facade">Sequence Facade</a>
28</h3></div></div></div>
29<h5>
30<a name="fusion.extension.sequence_facade.h0"></a>
31        <span class="phrase"><a name="fusion.extension.sequence_facade.description"></a></span><a class="link" href="sequence_facade.html#fusion.extension.sequence_facade.description">Description</a>
32      </h5>
33<p>
34        The <a class="link" href="sequence_facade.html" title="Sequence Facade"><code class="computeroutput"><span class="identifier">sequence_facade</span></code></a>
35        template provides an intrusive mechanism for producing a conforming Fusion
36        sequence.
37      </p>
38<h5>
39<a name="fusion.extension.sequence_facade.h1"></a>
40        <span class="phrase"><a name="fusion.extension.sequence_facade.synopsis"></a></span><a class="link" href="sequence_facade.html#fusion.extension.sequence_facade.synopsis">Synopsis</a>
41      </h5>
42<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>
43<span class="keyword">struct</span> <span class="identifier">sequence_facade</span><span class="special">;</span>
44</pre>
45<h5>
46<a name="fusion.extension.sequence_facade.h2"></a>
47        <span class="phrase"><a name="fusion.extension.sequence_facade.usage"></a></span><a class="link" href="sequence_facade.html#fusion.extension.sequence_facade.usage">Usage</a>
48      </h5>
49<p>
50        The user of <a class="link" href="sequence_facade.html" title="Sequence Facade"><code class="computeroutput"><span class="identifier">sequence_facade</span></code></a> derives his sequence
51        type from a specialization of <a class="link" href="sequence_facade.html" title="Sequence Facade"><code class="computeroutput"><span class="identifier">sequence_facade</span></code></a> and passes the derived
52        sequence type as the first template parameter. The second template parameter
53        should be the traversal category of the sequence being implemented. The 3rd
54        parameter should be set to <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span></code>
55        if the sequence is a view.
56      </p>
57<p>
58        The user must implement the key expressions required by their sequence type.
59      </p>
60<div class="table">
61<a name="fusion.extension.sequence_facade.t0"></a><p class="title"><b>Table 1.106. Parameters</b></p>
62<div class="table-contents"><table class="table" summary="Parameters">
63<colgroup>
64<col>
65<col>
66</colgroup>
67<thead><tr>
68<th>
69                <p>
70                  Name
71                </p>
72              </th>
73<th>
74                <p>
75                  Description
76                </p>
77              </th>
78</tr></thead>
79<tbody>
80<tr>
81<td>
82                <p>
83                  <code class="computeroutput"><span class="identifier">sequence</span></code>, <code class="computeroutput"><span class="identifier">Seq</span></code>
84                </p>
85              </td>
86<td>
87                <p>
88                  A type derived from <a class="link" href="sequence_facade.html" title="Sequence Facade"><code class="computeroutput"><span class="identifier">sequence_facade</span></code></a>
89                </p>
90              </td>
91</tr>
92<tr>
93<td>
94                <p>
95                  <code class="computeroutput"><span class="identifier">N</span></code>
96                </p>
97              </td>
98<td>
99                <p>
100                  An <a href="http://www.boost.org/libs/mpl/doc/refmanual/integral-constant.html" target="_top">MPL
101                  Integral Constant</a>
102                </p>
103              </td>
104</tr>
105</tbody>
106</table></div>
107</div>
108<br class="table-break"><div class="table">
109<a name="fusion.extension.sequence_facade.t1"></a><p class="title"><b>Table 1.107. Key Expressions</b></p>
110<div class="table-contents"><table class="table" summary="Key Expressions">
111<colgroup>
112<col>
113<col>
114</colgroup>
115<thead><tr>
116<th>
117                <p>
118                  Expression
119                </p>
120              </th>
121<th>
122                <p>
123                  Result
124                </p>
125              </th>
126</tr></thead>
127<tbody>
128<tr>
129<td>
130                <p>
131                  <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>
132                </p>
133              </td>
134<td>
135                <p>
136                  The type of an iterator to the beginning of a sequence of type
137                  <code class="computeroutput"><span class="identifier">Seq</span></code>
138                </p>
139              </td>
140</tr>
141<tr>
142<td>
143                <p>
144                  <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>
145                </p>
146              </td>
147<td>
148                <p>
149                  An iterator to the beginning of sequence <code class="computeroutput"><span class="identifier">seq</span></code>
150                </p>
151              </td>
152</tr>
153<tr>
154<td>
155                <p>
156                  <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>
157                </p>
158              </td>
159<td>
160                <p>
161                  The type of an iterator to the end of a sequence of type <code class="computeroutput"><span class="identifier">Seq</span></code>
162                </p>
163              </td>
164</tr>
165<tr>
166<td>
167                <p>
168                  <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>
169                </p>
170              </td>
171<td>
172                <p>
173                  An iterator to the end of sequence <code class="computeroutput"><span class="identifier">seq</span></code>
174                </p>
175              </td>
176</tr>
177<tr>
178<td>
179                <p>
180                  <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>
181                </p>
182              </td>
183<td>
184                <p>
185                  The size of a sequence of type <code class="computeroutput"><span class="identifier">Seq</span></code>
186                  as an <a href="http://www.boost.org/libs/mpl/doc/refmanual/integral-constant.html" target="_top">MPL
187                  Integral Constant</a>
188                </p>
189              </td>
190</tr>
191<tr>
192<td>
193                <p>
194                  <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>
195                </p>
196              </td>
197<td>
198                <p>
199                  The size of sequence <code class="computeroutput"><span class="identifier">seq</span></code>
200                </p>
201              </td>
202</tr>
203<tr>
204<td>
205                <p>
206                  <code class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">Seq</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
207                </p>
208              </td>
209<td>
210                <p>
211                  Returns <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span></code> if <code class="computeroutput"><span class="identifier">Seq</span></code>
212                  has zero elements, <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">false_</span></code>
213                  otherwise.
214                </p>
215              </td>
216</tr>
217<tr>
218<td>
219                <p>
220                  <code class="computeroutput"><span class="identifier">sequence</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">empty</span><span class="special">&lt;</span><span class="identifier">Seq</span><span class="special">&gt;::</span><span class="identifier">call</span></code>
221                </p>
222              </td>
223<td>
224                <p>
225                  Returns a type convertible to <code class="computeroutput"><span class="keyword">bool</span></code>
226                  that evaluates to true if the sequence is empty, else, evaluates
227                  to false.
228                </p>
229              </td>
230</tr>
231<tr>
232<td>
233                <p>
234                  <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>
235                </p>
236              </td>
237<td>
238                <p>
239                  The type of element <code class="computeroutput"><span class="identifier">N</span></code>
240                  in a sequence of type <code class="computeroutput"><span class="identifier">Seq</span></code>
241                </p>
242              </td>
243</tr>
244<tr>
245<td>
246                <p>
247                  <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>
248                </p>
249              </td>
250<td>
251                <p>
252                  Element <code class="computeroutput"><span class="identifier">N</span></code> in sequence
253                  <code class="computeroutput"><span class="identifier">seq</span></code>
254                </p>
255              </td>
256</tr>
257<tr>
258<td>
259                <p>
260                  <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>
261                </p>
262              </td>
263<td>
264                <p>
265                  The type of the <code class="computeroutput"><span class="identifier">N</span></code>th
266                  element in a sequence of type <code class="computeroutput"><span class="identifier">Seq</span></code>
267                </p>
268              </td>
269</tr>
270</tbody>
271</table></div>
272</div>
273<br class="table-break"><h5>
274<a name="fusion.extension.sequence_facade.h3"></a>
275        <span class="phrase"><a name="fusion.extension.sequence_facade.include"></a></span><a class="link" href="sequence_facade.html#fusion.extension.sequence_facade.include">Include</a>
276      </h5>
277<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>
278<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>
279</pre>
280<h5>
281<a name="fusion.extension.sequence_facade.h4"></a>
282        <span class="phrase"><a name="fusion.extension.sequence_facade.example"></a></span><a class="link" href="sequence_facade.html#fusion.extension.sequence_facade.example">Example</a>
283      </h5>
284<p>
285        A full working example using <a class="link" href="sequence_facade.html" title="Sequence Facade"><code class="computeroutput"><span class="identifier">sequence_facade</span></code></a> is provided in triple.cpp
286        in the extension examples.
287      </p>
288</div>
289<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
290<td align="left"></td>
291<td align="right"><div class="copyright-footer">Copyright © 2001-2006, 2011, 2012 Joel de Guzman,
292      Dan Marsden, Tobias Schwinger<p>
293        Distributed under the Boost Software License, Version 1.0. (See accompanying
294        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
295      </p>
296</div></td>
297</tr></table>
298<hr>
299<div class="spirit-nav">
300<a accesskey="p" href="ext_full.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../extension.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="iterator_facade.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
301</div>
302</body>
303</html>
304