2007-11-06 12:13:52 +00:00
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=ISO-8859-1" >
< title > Iterator Facade</ title >
2007-11-07 16:22:38 +00:00
< link rel = "stylesheet" href = "../../../../../../doc/html/boostbook.css" type = "text/css" >
2007-11-06 12:13:52 +00:00
< meta name = "generator" content = "DocBook XSL Stylesheets V1.66.1" >
< link rel = "start" href = "../../index.html" title = "Chapter 1. Fusion 2.0" >
< link rel = "up" href = "../extension.html" title = "Extension" >
< link rel = "prev" href = "sequence_facade.html" title = "Sequence Facade" >
2007-12-21 22:19:06 +00:00
< link rel = "next" href = "../functional.html" title = "Functional" >
2007-11-06 12:13:52 +00:00
</ head >
< body bgcolor = "white" text = "black" link = "#0000FF" vlink = "#840084" alink = "#0000FF" >
< table cellpadding = "2" width = "100%" >< tr >
< td valign = "top" >< img alt = "Boost C++ Libraries" width = "277" height = "86" src = "../../../../../../boost.png" ></ td >
< td align = "center" >< a href = "../../../../../../index.htm" > Home</ a ></ td >
< td align = "center" >< a href = "../../../../../libraries.htm" > Libraries</ a ></ td >
< td align = "center" >< a href = "../../../../../../people/people.htm" > People</ a ></ td >
< td align = "center" >< a href = "../../../../../../more/faq.htm" > FAQ</ a ></ td >
< td align = "center" >< a href = "../../../../../../more/index.htm" > More</ a ></ td >
</ tr ></ table >
< hr >
< div class = "spirit-nav" >
2007-12-21 22:19:06 +00:00
< a accesskey = "p" href = "sequence_facade.html" >< img src = "../../../../../../doc/html/images/prev.png" alt = "Prev" ></ a >< a accesskey = "u" href = "../extension.html" >< img src = "../../../../../../doc/html/images/up.png" alt = "Up" ></ a >< a accesskey = "h" href = "../../index.html" >< img src = "../../../../../../doc/html/images/home.png" alt = "Home" ></ a >< a accesskey = "n" href = "../functional.html" >< img src = "../../../../../../doc/html/images/next.png" alt = "Next" ></ a >
2007-11-06 12:13:52 +00:00
</ div >
< div class = "section" lang = "en" >
< 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 >
2007-12-21 22:19:06 +00:00
< a name = "id651774" ></ a >
2007-11-06 12:13:52 +00:00
< 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 >
template provides an intrusive mechanism for producing a conforming Fusion
iterator.
</ p >
< a name = "fusion.extension.iterator_facade.synopsis" ></ a >< h4 >
2007-12-21 22:19:06 +00:00
< a name = "id651822" ></ a >
2007-11-06 12:13:52 +00:00
< a href = "iterator_facade.html#fusion.extension.iterator_facade.synopsis" > Synopsis</ a >
</ h4 >
< pre class = "programlisting" >
< span class = "keyword" > template</ span >< span class = "special" > < </ 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" > struct</ span > < span class = "identifier" > iterator_facade</ span >< span class = "special" > ;</ span >
</ pre >
< a name = "fusion.extension.iterator_facade.usage" ></ a >< h4 >
2007-12-21 22:19:06 +00:00
< a name = "id651917" ></ a >
2007-11-06 12:13:52 +00:00
< a href = "iterator_facade.html#fusion.extension.iterator_facade.usage" > Usage</ a >
</ h4 >
< p >
The user of iterator_facade derives his iterator type from a specialization
of iterator_facade and passes the derived iterator type as the first template
parameter. The second template parameter should be the traversal category
of the iterator being implemented.
</ p >
< p >
The user must the implement the key expressions required by their iterator
type.
</ p >
< div class = "table" >
2007-12-21 22:19:06 +00:00
< a name = "id651943" ></ a >< p class = "title" >< b > Table 1.93. Parameters</ b ></ p >
2007-11-06 12:13:52 +00:00
< table class = "table" summary = "Parameters" >
< colgroup >
< col >
< col >
</ colgroup >
< thead >< tr >
< th >
< p >
Name
</ p >
</ th >
< th >
< p >
Description
</ p >
</ th >
</ tr ></ thead >
< tbody >
< 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 >
</ 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 >
</ p >
</ td >
</ tr >
< tr >
< td >
< p >
< tt class = "computeroutput" >< span class = "identifier" > N</ span ></ tt >
</ p >
</ td >
< td >
< p >
An < a href = "http://www.boost.org/libs/mpl/doc/refmanual/integral-constant.html" target = "_top" > MPL
Integral Constant</ a >
</ p >
</ td >
</ tr >
</ tbody >
</ table >
</ div >
< div class = "table" >
2007-12-21 22:19:06 +00:00
< a name = "id652101" ></ a >< p class = "title" >< b > Table 1.94. Key Expressions</ b ></ p >
2007-11-06 12:13:52 +00:00
< table class = "table" summary = "Key Expressions" >
< colgroup >
< col >
< col >
< col >
</ colgroup >
< thead >< tr >
< th >
< p >
Expression
</ p >
</ th >
< th >
< p >
Result
</ p >
</ th >
< th >
< p >
Default
</ p >
</ th >
</ tr ></ thead >
< tbody >
< 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" > < </ span >< span class = "identifier" > It</ span >< span class = "special" > > ::</ span >< span class = "identifier" > type</ span ></ tt >
</ p >
</ td >
< td >
< p >
The element stored at iterator position < tt class = "computeroutput" >< span class = "identifier" > It</ span ></ tt >
</ p >
</ td >
< td >
< p >
None
</ 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" > deref</ span >< span class = "special" > < </ span >< span class = "identifier" > It</ span >< span class = "special" > > ::</ span >< span class = "identifier" > type</ span ></ tt >
</ p >
</ td >
< td >
< p >
The type returned when dereferencing an iterator of type < tt class = "computeroutput" >< span class = "identifier" > It</ span ></ tt >
</ p >
</ td >
< td >
< p >
None
</ 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" > deref</ span >< span class = "special" > < </ span >< span class = "identifier" > It</ span >< span class = "special" > > ::</ span >< span class = "identifier" > call</ span >< span class = "special" > (</ span >< span class = "identifier" > it</ span >< span class = "special" > )</ span ></ tt >
</ p >
</ td >
< td >
< p >
Dereferences iterator < tt class = "computeroutput" >< span class = "identifier" > it</ span ></ tt >
</ p >
</ td >
< td >
< p >
None
</ 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" > next</ span >< span class = "special" > < </ span >< span class = "identifier" > It</ span >< span class = "special" > > ::</ span >< span class = "identifier" > type</ span ></ tt >
</ p >
</ td >
< td >
< p >
The type of the next element from < tt class = "computeroutput" >< span class = "identifier" > It</ span ></ tt >
</ p >
</ td >
< td >
< p >
None
</ 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" > next</ span >< span class = "special" > < </ span >< span class = "identifier" > It</ span >< span class = "special" > > ::</ span >< span class = "identifier" > call</ span >< span class = "special" > (</ span >< span class = "identifier" > it</ span >< span class = "special" > )</ span ></ tt >
</ p >
</ td >
< td >
< p >
The next iterator after < tt class = "computeroutput" >< span class = "identifier" > it</ span ></ tt >
</ p >
</ td >
< td >
< p >
None
</ 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" > prior</ span >< span class = "special" > < </ span >< span class = "identifier" > It</ span >< span class = "special" > > ::</ span >< span class = "identifier" > type</ span ></ tt >
</ p >
</ td >
< td >
< p >
The type of the next element from < tt class = "computeroutput" >< span class = "identifier" > It</ span ></ tt >
</ p >
</ td >
< td >
< p >
None
</ 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" > prior</ span >< span class = "special" > < </ span >< span class = "identifier" > It</ span >< span class = "special" > > ::</ span >< span class = "identifier" > call</ span >< span class = "special" > (</ span >< span class = "identifier" > it</ span >< span class = "special" > )</ span ></ tt >
</ p >
</ td >
< td >
< p >
The next iterator after < tt class = "computeroutput" >< span class = "identifier" > it</ span ></ tt >
</ p >
</ td >
< td >
< p >
None
</ 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" > < </ span >< span class = "identifier" > It</ span >< span class = "special" > ,</ span > < span class = "identifier" > N</ span >< span class = "special" > > ::</ span >< span class = "identifier" > type</ span ></ tt >
</ 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 >
</ 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 >
</ 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" > < </ span >< span class = "identifier" > It</ span >< span class = "special" > ,</ span > < span class = "identifier" > N</ span >< span class = "special" > > ::</ span >< span class = "identifier" > call</ span >< span class = "special" > (</ span >< span class = "identifier" > it</ span >< span class = "special" > )</ span ></ tt >
</ 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 >
</ 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 >
</ 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" > < </ span >< span class = "identifier" > It1</ span >< span class = "special" > ,</ span > < span class = "identifier" > It2</ span >< span class = "special" > > ::</ span >< span class = "identifier" > type</ span ></ tt >
</ 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
Integral Constant</ a >
</ p >
</ td >
< td >
< p >
None
</ 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" > < </ span >< span class = "identifier" > It1</ span >< span class = "special" > ,</ span > < span class = "identifier" > It2</ span >< span class = "special" > > ::</ 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 >
</ 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 >
</ p >
</ td >
< td >
< p >
None
</ 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" > < </ span >< span class = "identifier" > It1</ span >< span class = "special" > ,</ span > < span class = "identifier" > It2</ span >< span class = "special" > > ::</ span >< span class = "identifier" > type</ span ></ tt >
</ 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 >
</ 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" > < </ span >< span class = "identifier" > It1</ span >< span class = "special" > ,</ span > < span class = "identifier" > It2</ span >< span class = "special" > > ::</ span >< span class = "identifier" > type</ span ></ tt >
</ 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" > < </ span >< span class = "identifier" > It1</ span >< span class = "special" > ,</ span > < span class = "identifier" > It2</ span >< span class = "special" > > ::</ 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 >
</ 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 >
</ 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" > < </ span >< span class = "identifier" > It1</ span >< span class = "special" > ,</ span > < span class = "identifier" > It2</ span >< span class = "special" > > ::</ span >< span class = "identifier" > type</ span >< span class = "special" > ()</ span ></ tt >
</ p >
</ td >
</ tr >
</ tbody >
</ table >
</ div >
< a name = "fusion.extension.iterator_facade.header" ></ a >< h4 >
2007-12-21 22:19:06 +00:00
< a name = "id653660" ></ a >
2007-11-06 12:13:52 +00:00
< a href = "iterator_facade.html#fusion.extension.iterator_facade.header" > Header</ a >
</ h4 >
< pre class = "programlisting" >
< span class = "preprocessor" > #include</ span > < span class = "special" > < </ span >< span class = "identifier" > boost</ span >< span class = "special" > /</ span >< span class = "identifier" > fusion</ span >< span class = "special" > /</ span >< span class = "identifier" > iterator</ span >< span class = "special" > /</ span >< span class = "identifier" > iterator_facade</ span >< span class = "special" > .</ span >< span class = "identifier" > hpp</ span >< span class = "special" > > </ span >
< span class = "preprocessor" > #include</ span > < span class = "special" > < </ span >< span class = "identifier" > boost</ span >< span class = "special" > /</ span >< span class = "identifier" > fusion</ span >< span class = "special" > /</ span >< span class = "identifier" > include</ span >< span class = "special" > /</ span >< span class = "identifier" > iterator_facade</ span >< span class = "special" > .</ span >< span class = "identifier" > hpp</ span >< span class = "special" > > </ span >
</ pre >
2007-11-07 16:22:38 +00:00
< a name = "fusion.extension.iterator_facade.example" ></ a >< h4 >
2007-12-21 22:19:06 +00:00
< a name = "id653820" ></ a >
2007-11-07 16:22:38 +00:00
< a href = "iterator_facade.html#fusion.extension.iterator_facade.example" > Example</ a >
</ h4 >
< p >
2007-12-21 22:19:06 +00:00
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
2007-11-07 16:22:38 +00:00
in the extension examples.
</ p >
2007-11-06 12:13:52 +00:00
</ div >
< table xmlns:rev = "http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width = "100%" >< tr >
< td align = "left" ></ td >
2007-11-16 08:03:15 +00:00
< td align = "right" >< div class = "copyright-footer" > Copyright © 2001-2007 Joel de Guzman, Dan Marsden, Tobias
2007-11-07 16:22:38 +00:00
Schwinger< p >
Distributed under the Boost Software License, Version 1.0. (See accompanying
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 > )
2007-11-16 08:03:15 +00:00
</ p >
</ div ></ td >
2007-11-06 12:13:52 +00:00
</ tr ></ table >
< hr >
< div class = "spirit-nav" >
2007-12-21 22:19:06 +00:00
< a accesskey = "p" href = "sequence_facade.html" >< img src = "../../../../../../doc/html/images/prev.png" alt = "Prev" ></ a >< a accesskey = "u" href = "../extension.html" >< img src = "../../../../../../doc/html/images/up.png" alt = "Up" ></ a >< a accesskey = "h" href = "../../index.html" >< img src = "../../../../../../doc/html/images/home.png" alt = "Home" ></ a >< a accesskey = "n" href = "../functional.html" >< img src = "../../../../../../doc/html/images/next.png" alt = "Next" ></ a >
2007-11-06 12:13:52 +00:00
</ div >
</ body >
</ html >