• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Iterator 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="sequence_facade.html" title="Sequence Facade">
10<link rel="next" href="../functional.html" title="Functional">
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="sequence_facade.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="../functional.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.iterator_facade"></a><a class="link" href="iterator_facade.html" title="Iterator Facade">Iterator Facade</a>
28</h3></div></div></div>
29<h5>
30<a name="fusion.extension.iterator_facade.h0"></a>
31        <span class="phrase"><a name="fusion.extension.iterator_facade.description"></a></span><a class="link" href="iterator_facade.html#fusion.extension.iterator_facade.description">Description</a>
32      </h5>
33<p>
34        The <a class="link" href="iterator_facade.html" title="Iterator Facade"><code class="computeroutput"><span class="identifier">iterator_facade</span></code></a>
35        template provides an intrusive mechanism for producing a conforming Fusion
36        iterator.
37      </p>
38<h5>
39<a name="fusion.extension.iterator_facade.h1"></a>
40        <span class="phrase"><a name="fusion.extension.iterator_facade.synopsis"></a></span><a class="link" href="iterator_facade.html#fusion.extension.iterator_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">&gt;</span>
43<span class="keyword">struct</span> <span class="identifier">iterator_facade</span><span class="special">;</span>
44</pre>
45<h5>
46<a name="fusion.extension.iterator_facade.h2"></a>
47        <span class="phrase"><a name="fusion.extension.iterator_facade.usage"></a></span><a class="link" href="iterator_facade.html#fusion.extension.iterator_facade.usage">Usage</a>
48      </h5>
49<p>
50        The user of iterator_facade derives his iterator type from a specialization
51        of iterator_facade and passes the derived iterator type as the first template
52        parameter. The second template parameter should be the traversal category
53        of the iterator being implemented.
54      </p>
55<p>
56        The user must implement the key expressions required by their iterator type.
57      </p>
58<div class="table">
59<a name="fusion.extension.iterator_facade.t0"></a><p class="title"><b>Table 1.108. Parameters</b></p>
60<div class="table-contents"><table class="table" summary="Parameters">
61<colgroup>
62<col>
63<col>
64</colgroup>
65<thead><tr>
66<th>
67                <p>
68                  Name
69                </p>
70              </th>
71<th>
72                <p>
73                  Description
74                </p>
75              </th>
76</tr></thead>
77<tbody>
78<tr>
79<td>
80                <p>
81                  <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>,
82                  <code class="computeroutput"><span class="identifier">It2</span></code>
83                </p>
84              </td>
85<td>
86                <p>
87                  A type derived from <a class="link" href="iterator_facade.html" title="Iterator Facade"><code class="computeroutput"><span class="identifier">iterator_facade</span></code></a>
88                </p>
89              </td>
90</tr>
91<tr>
92<td>
93                <p>
94                  <code class="computeroutput"><span class="identifier">N</span></code>
95                </p>
96              </td>
97<td>
98                <p>
99                  An <a href="http://www.boost.org/libs/mpl/doc/refmanual/integral-constant.html" target="_top">MPL
100                  Integral Constant</a>
101                </p>
102              </td>
103</tr>
104</tbody>
105</table></div>
106</div>
107<br class="table-break"><div class="table">
108<a name="fusion.extension.iterator_facade.t1"></a><p class="title"><b>Table 1.109. Key Expressions</b></p>
109<div class="table-contents"><table class="table" summary="Key Expressions">
110<colgroup>
111<col>
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<th>
127                <p>
128                  Default
129                </p>
130              </th>
131</tr></thead>
132<tbody>
133<tr>
134<td>
135                <p>
136                  <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>
137                </p>
138              </td>
139<td>
140                <p>
141                  The element stored at iterator position <code class="computeroutput"><span class="identifier">It</span></code>
142                </p>
143              </td>
144<td>
145                <p>
146                  None
147                </p>
148              </td>
149</tr>
150<tr>
151<td>
152                <p>
153                  <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>
154                </p>
155              </td>
156<td>
157                <p>
158                  The type returned when dereferencing an iterator of type <code class="computeroutput"><span class="identifier">It</span></code>
159                </p>
160              </td>
161<td>
162                <p>
163                  None
164                </p>
165              </td>
166</tr>
167<tr>
168<td>
169                <p>
170                  <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>
171                </p>
172              </td>
173<td>
174                <p>
175                  Dereferences iterator <code class="computeroutput"><span class="identifier">it</span></code>
176                </p>
177              </td>
178<td>
179                <p>
180                  None
181                </p>
182              </td>
183</tr>
184<tr>
185<td>
186                <p>
187                  <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>
188                </p>
189              </td>
190<td>
191                <p>
192                  The type of the next element from <code class="computeroutput"><span class="identifier">It</span></code>
193                </p>
194              </td>
195<td>
196                <p>
197                  None
198                </p>
199              </td>
200</tr>
201<tr>
202<td>
203                <p>
204                  <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>
205                </p>
206              </td>
207<td>
208                <p>
209                  The next iterator after <code class="computeroutput"><span class="identifier">it</span></code>
210                </p>
211              </td>
212<td>
213                <p>
214                  None
215                </p>
216              </td>
217</tr>
218<tr>
219<td>
220                <p>
221                  <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>
222                </p>
223              </td>
224<td>
225                <p>
226                  The type of the next element from <code class="computeroutput"><span class="identifier">It</span></code>
227                </p>
228              </td>
229<td>
230                <p>
231                  None
232                </p>
233              </td>
234</tr>
235<tr>
236<td>
237                <p>
238                  <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>
239                </p>
240              </td>
241<td>
242                <p>
243                  The next iterator after <code class="computeroutput"><span class="identifier">it</span></code>
244                </p>
245              </td>
246<td>
247                <p>
248                  None
249                </p>
250              </td>
251</tr>
252<tr>
253<td>
254                <p>
255                  <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>
256                </p>
257              </td>
258<td>
259                <p>
260                  The type of an iterator advanced <code class="computeroutput"><span class="identifier">N</span></code>
261                  elements from <code class="computeroutput"><span class="identifier">It</span></code>
262                </p>
263              </td>
264<td>
265                <p>
266                  Implemented in terms of <code class="computeroutput"><span class="identifier">next</span></code>
267                  and <code class="computeroutput"><span class="identifier">prior</span></code>
268                </p>
269              </td>
270</tr>
271<tr>
272<td>
273                <p>
274                  <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>
275                </p>
276              </td>
277<td>
278                <p>
279                  An iterator advanced <code class="computeroutput"><span class="identifier">N</span></code>
280                  elements from <code class="computeroutput"><span class="identifier">it</span></code>
281                </p>
282              </td>
283<td>
284                <p>
285                  Implemented in terms of <code class="computeroutput"><span class="identifier">next</span></code>
286                  and <code class="computeroutput"><span class="identifier">prior</span></code>
287                </p>
288              </td>
289</tr>
290<tr>
291<td>
292                <p>
293                  <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>
294                </p>
295              </td>
296<td>
297                <p>
298                  The distance between iterators of type <code class="computeroutput"><span class="identifier">It1</span></code>
299                  and <code class="computeroutput"><span class="identifier">It2</span></code> as an
300                  <a href="http://www.boost.org/libs/mpl/doc/refmanual/integral-constant.html" target="_top">MPL
301                  Integral Constant</a>
302                </p>
303              </td>
304<td>
305                <p>
306                  None
307                </p>
308              </td>
309</tr>
310<tr>
311<td>
312                <p>
313                  <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>
314                </p>
315              </td>
316<td>
317                <p>
318                  The distance between iterator <code class="computeroutput"><span class="identifier">it1</span></code>
319                  and <code class="computeroutput"><span class="identifier">it2</span></code>
320                </p>
321              </td>
322<td>
323                <p>
324                  None
325                </p>
326              </td>
327</tr>
328<tr>
329<td>
330                <p>
331                  <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>
332                </p>
333              </td>
334<td>
335                <p>
336                  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">It1</span></code>
337                  is equal to <code class="computeroutput"><span class="identifier">It2</span></code>,
338                  <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">false_</span></code> otherwise.
339                </p>
340              </td>
341<td>
342                <p>
343                  <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>
344                  <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
345                </p>
346              </td>
347</tr>
348<tr>
349<td>
350                <p>
351                  <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>
352                </p>
353              </td>
354<td>
355                <p>
356                  Returns a type convertible to <code class="computeroutput"><span class="keyword">bool</span></code>
357                  that evaluates to <code class="computeroutput"><span class="keyword">true</span></code>
358                  if <code class="computeroutput"><span class="identifier">It1</span></code> is equal
359                  to <code class="computeroutput"><span class="identifier">It2</span></code>, <code class="computeroutput"><span class="keyword">false</span></code> otherwise.
360                </p>
361              </td>
362<td>
363                <p>
364                  <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>
365                  <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">()</span></code>
366                </p>
367              </td>
368</tr>
369<tr>
370<td>
371                <p>
372                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">key_of</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
373                </p>
374              </td>
375<td>
376                <p>
377                  The key type associated with the element from <code class="computeroutput"><span class="identifier">It</span></code>
378                </p>
379              </td>
380<td>
381                <p>
382                  None
383                </p>
384              </td>
385</tr>
386<tr>
387<td>
388                <p>
389                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">value_of_data</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
390                </p>
391              </td>
392<td>
393                <p>
394                  The type of the data property associated with the element from
395                  <code class="computeroutput"><span class="identifier">It</span></code>
396                </p>
397              </td>
398<td>
399                <p>
400                  None
401                </p>
402              </td>
403</tr>
404<tr>
405<td>
406                <p>
407                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">deref_data</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
408                </p>
409              </td>
410<td>
411                <p>
412                  The type that will be returned by dereferencing the data property
413                  of the element from <code class="computeroutput"><span class="identifier">It</span></code>
414                </p>
415              </td>
416<td>
417                <p>
418                  None
419                </p>
420              </td>
421</tr>
422<tr>
423<td>
424                <p>
425                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">deref_data</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>
426                </p>
427              </td>
428<td>
429                <p>
430                  Deferences the data property associated with the element referenced
431                  by <code class="computeroutput"><span class="identifier">it</span></code>
432                </p>
433              </td>
434<td>
435                <p>
436                  None
437                </p>
438              </td>
439</tr>
440</tbody>
441</table></div>
442</div>
443<br class="table-break"><h5>
444<a name="fusion.extension.iterator_facade.h3"></a>
445        <span class="phrase"><a name="fusion.extension.iterator_facade.header"></a></span><a class="link" href="iterator_facade.html#fusion.extension.iterator_facade.header">Header</a>
446      </h5>
447<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>
448<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>
449</pre>
450<h5>
451<a name="fusion.extension.iterator_facade.h4"></a>
452        <span class="phrase"><a name="fusion.extension.iterator_facade.example"></a></span><a class="link" href="iterator_facade.html#fusion.extension.iterator_facade.example">Example</a>
453      </h5>
454<p>
455        A full working example using <a class="link" href="iterator_facade.html" title="Iterator Facade"><code class="computeroutput"><span class="identifier">iterator_facade</span></code></a> is provided in triple.cpp
456        in the extension examples.
457      </p>
458</div>
459<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
460<td align="left"></td>
461<td align="right"><div class="copyright-footer">Copyright © 2001-2006, 2011, 2012 Joel de Guzman,
462      Dan Marsden, Tobias Schwinger<p>
463        Distributed under the Boost Software License, Version 1.0. (See accompanying
464        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>)
465      </p>
466</div></td>
467</tr></table>
468<hr>
469<div class="spirit-nav">
470<a accesskey="p" href="sequence_facade.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="../functional.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
471</div>
472</body>
473</html>
474