mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-12 14:01:37 +00:00
a couple small edits to the iterator facade tutorial
[SVN r21620]
This commit is contained in:
parent
f0add8a043
commit
7fc54ec2d8
@ -7,7 +7,7 @@
|
|||||||
<title>Function Output Iterator</title>
|
<title>Function Output Iterator</title>
|
||||||
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
|
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
|
||||||
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
|
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
|
||||||
<meta name="date" content="2003-09-14" />
|
<meta name="date" content="2004-01-12" />
|
||||||
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
||||||
<link rel="stylesheet" href="default.css" type="text/css" />
|
<link rel="stylesheet" href="default.css" type="text/css" />
|
||||||
</head>
|
</head>
|
||||||
@ -27,7 +27,7 @@
|
|||||||
Lab</a>, University of Hanover <a class="last reference" href="http://www.ive.uni-hannover.de">Institute for Transport
|
Lab</a>, University of Hanover <a class="last reference" href="http://www.ive.uni-hannover.de">Institute for Transport
|
||||||
Railway Operation and Construction</a></td></tr>
|
Railway Operation and Construction</a></td></tr>
|
||||||
<tr><th class="docinfo-name">Date:</th>
|
<tr><th class="docinfo-name">Date:</th>
|
||||||
<td>2003-09-14</td></tr>
|
<td>2004-01-12</td></tr>
|
||||||
<tr><th class="docinfo-name">Copyright:</th>
|
<tr><th class="docinfo-name">Copyright:</th>
|
||||||
<td>Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved</td></tr>
|
<td>Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved</td></tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<title>Indirect Iterator</title>
|
<title>Indirect Iterator</title>
|
||||||
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
|
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
|
||||||
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
|
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
|
||||||
<meta name="date" content="2003-09-14" />
|
<meta name="date" content="2004-01-12" />
|
||||||
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
||||||
<link rel="stylesheet" href="default.css" type="text/css" />
|
<link rel="stylesheet" href="default.css" type="text/css" />
|
||||||
</head>
|
</head>
|
||||||
@ -27,7 +27,7 @@
|
|||||||
Lab</a>, University of Hanover <a class="last reference" href="http://www.ive.uni-hannover.de">Institute for Transport
|
Lab</a>, University of Hanover <a class="last reference" href="http://www.ive.uni-hannover.de">Institute for Transport
|
||||||
Railway Operation and Construction</a></td></tr>
|
Railway Operation and Construction</a></td></tr>
|
||||||
<tr><th class="docinfo-name">Date:</th>
|
<tr><th class="docinfo-name">Date:</th>
|
||||||
<td>2003-09-14</td></tr>
|
<td>2004-01-12</td></tr>
|
||||||
<tr><th class="docinfo-name">Copyright:</th>
|
<tr><th class="docinfo-name">Copyright:</th>
|
||||||
<td>Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved</td></tr>
|
<td>Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved</td></tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -3,240 +3,13 @@
|
|||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
<meta name="generator" content="Docutils 0.3.0: http://docutils.sourceforge.net/" />
|
||||||
<title>Iterator Facade</title>
|
<title>Iterator Facade</title>
|
||||||
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
|
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
|
||||||
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
|
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
|
||||||
<meta name="date" content="2004-01-11" />
|
<meta name="date" content="2004-01-11" />
|
||||||
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
||||||
<style type="text/css"><!--
|
<link rel="stylesheet" href="default.css" type="text/css" />
|
||||||
|
|
||||||
/*
|
|
||||||
:Author: David Goodger
|
|
||||||
:Contact: goodger@users.sourceforge.net
|
|
||||||
:date: $Date$
|
|
||||||
:version: $Revision$
|
|
||||||
:copyright: This stylesheet has been placed in the public domain.
|
|
||||||
|
|
||||||
Default cascading style sheet for the HTML output of Docutils.
|
|
||||||
*/
|
|
||||||
|
|
||||||
.first {
|
|
||||||
margin-top: 0 }
|
|
||||||
|
|
||||||
.last {
|
|
||||||
margin-bottom: 0 }
|
|
||||||
|
|
||||||
a.toc-backref {
|
|
||||||
text-decoration: none ;
|
|
||||||
color: black }
|
|
||||||
|
|
||||||
dd {
|
|
||||||
margin-bottom: 0.5em }
|
|
||||||
|
|
||||||
div.abstract {
|
|
||||||
margin: 2em 5em }
|
|
||||||
|
|
||||||
div.abstract p.topic-title {
|
|
||||||
font-weight: bold ;
|
|
||||||
text-align: center }
|
|
||||||
|
|
||||||
div.attention, div.caution, div.danger, div.error, div.hint,
|
|
||||||
div.important, div.note, div.tip, div.warning, div.admonition {
|
|
||||||
margin: 2em ;
|
|
||||||
border: medium outset ;
|
|
||||||
padding: 1em }
|
|
||||||
|
|
||||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
|
||||||
div.danger p.admonition-title, div.error p.admonition-title,
|
|
||||||
div.warning p.admonition-title {
|
|
||||||
color: red ;
|
|
||||||
font-weight: bold ;
|
|
||||||
font-family: sans-serif }
|
|
||||||
|
|
||||||
div.hint p.admonition-title, div.important p.admonition-title,
|
|
||||||
div.note p.admonition-title, div.tip p.admonition-title,
|
|
||||||
div.admonition p.admonition-title {
|
|
||||||
font-weight: bold ;
|
|
||||||
font-family: sans-serif }
|
|
||||||
|
|
||||||
div.dedication {
|
|
||||||
margin: 2em 5em ;
|
|
||||||
text-align: center ;
|
|
||||||
font-style: italic }
|
|
||||||
|
|
||||||
div.dedication p.topic-title {
|
|
||||||
font-weight: bold ;
|
|
||||||
font-style: normal }
|
|
||||||
|
|
||||||
div.figure {
|
|
||||||
margin-left: 2em }
|
|
||||||
|
|
||||||
div.footer, div.header {
|
|
||||||
font-size: smaller }
|
|
||||||
|
|
||||||
div.sidebar {
|
|
||||||
margin-left: 1em ;
|
|
||||||
border: medium outset ;
|
|
||||||
padding: 0em 1em ;
|
|
||||||
background-color: #ffffee ;
|
|
||||||
width: 40% ;
|
|
||||||
float: right ;
|
|
||||||
clear: right }
|
|
||||||
|
|
||||||
div.sidebar p.rubric {
|
|
||||||
font-family: sans-serif ;
|
|
||||||
font-size: medium }
|
|
||||||
|
|
||||||
div.system-messages {
|
|
||||||
margin: 5em }
|
|
||||||
|
|
||||||
div.system-messages h1 {
|
|
||||||
color: red }
|
|
||||||
|
|
||||||
div.system-message {
|
|
||||||
border: medium outset ;
|
|
||||||
padding: 1em }
|
|
||||||
|
|
||||||
div.system-message p.system-message-title {
|
|
||||||
color: red ;
|
|
||||||
font-weight: bold }
|
|
||||||
|
|
||||||
div.topic {
|
|
||||||
margin: 2em }
|
|
||||||
|
|
||||||
h1.title {
|
|
||||||
text-align: center }
|
|
||||||
|
|
||||||
h2.subtitle {
|
|
||||||
text-align: center }
|
|
||||||
|
|
||||||
hr {
|
|
||||||
width: 75% }
|
|
||||||
|
|
||||||
ol.simple, ul.simple {
|
|
||||||
margin-bottom: 1em }
|
|
||||||
|
|
||||||
ol.arabic {
|
|
||||||
list-style: decimal }
|
|
||||||
|
|
||||||
ol.loweralpha {
|
|
||||||
list-style: lower-alpha }
|
|
||||||
|
|
||||||
ol.upperalpha {
|
|
||||||
list-style: upper-alpha }
|
|
||||||
|
|
||||||
ol.lowerroman {
|
|
||||||
list-style: lower-roman }
|
|
||||||
|
|
||||||
ol.upperroman {
|
|
||||||
list-style: upper-roman }
|
|
||||||
|
|
||||||
p.attribution {
|
|
||||||
text-align: right ;
|
|
||||||
margin-left: 50% }
|
|
||||||
|
|
||||||
p.caption {
|
|
||||||
font-style: italic }
|
|
||||||
|
|
||||||
p.credits {
|
|
||||||
font-style: italic ;
|
|
||||||
font-size: smaller }
|
|
||||||
|
|
||||||
p.label {
|
|
||||||
white-space: nowrap }
|
|
||||||
|
|
||||||
p.rubric {
|
|
||||||
font-weight: bold ;
|
|
||||||
font-size: larger ;
|
|
||||||
color: maroon ;
|
|
||||||
text-align: center }
|
|
||||||
|
|
||||||
p.sidebar-title {
|
|
||||||
font-family: sans-serif ;
|
|
||||||
font-weight: bold ;
|
|
||||||
font-size: larger }
|
|
||||||
|
|
||||||
p.sidebar-subtitle {
|
|
||||||
font-family: sans-serif ;
|
|
||||||
font-weight: bold }
|
|
||||||
|
|
||||||
p.topic-title {
|
|
||||||
font-weight: bold }
|
|
||||||
|
|
||||||
pre.address {
|
|
||||||
margin-bottom: 0 ;
|
|
||||||
margin-top: 0 ;
|
|
||||||
font-family: serif ;
|
|
||||||
font-size: 100% }
|
|
||||||
|
|
||||||
pre.line-block {
|
|
||||||
font-family: serif ;
|
|
||||||
font-size: 100% }
|
|
||||||
|
|
||||||
pre.literal-block, pre.doctest-block {
|
|
||||||
margin-left: 2em ;
|
|
||||||
margin-right: 2em ;
|
|
||||||
background-color: #eeeeee }
|
|
||||||
|
|
||||||
span.classifier {
|
|
||||||
font-family: sans-serif ;
|
|
||||||
font-style: oblique }
|
|
||||||
|
|
||||||
span.classifier-delimiter {
|
|
||||||
font-family: sans-serif ;
|
|
||||||
font-weight: bold }
|
|
||||||
|
|
||||||
span.interpreted {
|
|
||||||
font-family: sans-serif }
|
|
||||||
|
|
||||||
span.option {
|
|
||||||
white-space: nowrap }
|
|
||||||
|
|
||||||
span.option-argument {
|
|
||||||
font-style: italic }
|
|
||||||
|
|
||||||
span.pre {
|
|
||||||
white-space: pre }
|
|
||||||
|
|
||||||
span.problematic {
|
|
||||||
color: red }
|
|
||||||
|
|
||||||
table {
|
|
||||||
margin-top: 0.5em ;
|
|
||||||
margin-bottom: 0.5em }
|
|
||||||
|
|
||||||
table.citation {
|
|
||||||
border-left: solid thin gray ;
|
|
||||||
padding-left: 0.5ex }
|
|
||||||
|
|
||||||
table.docinfo {
|
|
||||||
margin: 2em 4em }
|
|
||||||
|
|
||||||
table.footnote {
|
|
||||||
border-left: solid thin black ;
|
|
||||||
padding-left: 0.5ex }
|
|
||||||
|
|
||||||
td, th {
|
|
||||||
padding-left: 0.5em ;
|
|
||||||
padding-right: 0.5em ;
|
|
||||||
vertical-align: top }
|
|
||||||
|
|
||||||
th.docinfo-name, th.field-name {
|
|
||||||
font-weight: bold ;
|
|
||||||
text-align: left ;
|
|
||||||
white-space: nowrap }
|
|
||||||
|
|
||||||
h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
|
|
||||||
font-size: 100% }
|
|
||||||
|
|
||||||
tt {
|
|
||||||
background-color: #eeeeee }
|
|
||||||
|
|
||||||
ul.auto-toc {
|
|
||||||
list-style-type: none }
|
|
||||||
|
|
||||||
--></style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="document" id="iterator-facade">
|
<div class="document" id="iterator-facade">
|
||||||
@ -284,7 +57,7 @@ and associated types, to be supplied by a derived iterator class.</td>
|
|||||||
<li><a class="reference" href="#introduction" id="id27" name="id27">Introduction</a></li>
|
<li><a class="reference" href="#introduction" id="id27" name="id27">Introduction</a></li>
|
||||||
<li><a class="reference" href="#the-problem" id="id28" name="id28">The Problem</a></li>
|
<li><a class="reference" href="#the-problem" id="id28" name="id28">The Problem</a></li>
|
||||||
<li><a class="reference" href="#a-basic-iterator-using-iterator-facade" id="id29" name="id29">A Basic Iterator Using <tt class="literal"><span class="pre">iterator_facade</span></tt></a><ul>
|
<li><a class="reference" href="#a-basic-iterator-using-iterator-facade" id="id29" name="id29">A Basic Iterator Using <tt class="literal"><span class="pre">iterator_facade</span></tt></a><ul>
|
||||||
<li><a class="reference" href="#template-parameters" id="id30" name="id30">Template Parameters</a><ul>
|
<li><a class="reference" href="#template-arguments-for-iterator-facade" id="id30" name="id30">Template Arguments for <tt class="literal"><span class="pre">iterator_facade</span></tt></a><ul>
|
||||||
<li><a class="reference" href="#derived" id="id31" name="id31"><tt class="literal"><span class="pre">Derived</span></tt></a></li>
|
<li><a class="reference" href="#derived" id="id31" name="id31"><tt class="literal"><span class="pre">Derived</span></tt></a></li>
|
||||||
<li><a class="reference" href="#value" id="id32" name="id32"><tt class="literal"><span class="pre">Value</span></tt></a></li>
|
<li><a class="reference" href="#value" id="id32" name="id32"><tt class="literal"><span class="pre">Value</span></tt></a></li>
|
||||||
<li><a class="reference" href="#categoryortraversal" id="id33" name="id33"><tt class="literal"><span class="pre">CategoryOrTraversal</span></tt></a></li>
|
<li><a class="reference" href="#categoryortraversal" id="id33" name="id33"><tt class="literal"><span class="pre">CategoryOrTraversal</span></tt></a></li>
|
||||||
@ -580,10 +353,23 @@ lists.</p>
|
|||||||
</div>
|
</div>
|
||||||
<div class="section" id="a-basic-iterator-using-iterator-facade">
|
<div class="section" id="a-basic-iterator-using-iterator-facade">
|
||||||
<h2><a class="toc-backref" href="#id29" name="a-basic-iterator-using-iterator-facade">A Basic Iterator Using <tt class="literal"><span class="pre">iterator_facade</span></tt></a></h2>
|
<h2><a class="toc-backref" href="#id29" name="a-basic-iterator-using-iterator-facade">A Basic Iterator Using <tt class="literal"><span class="pre">iterator_facade</span></tt></a></h2>
|
||||||
<div class="section" id="template-parameters">
|
<p>We will construct a <tt class="literal"><span class="pre">node_iterator</span></tt> class using inheritance from
|
||||||
<h3><a class="toc-backref" href="#id30" name="template-parameters">Template Parameters</a></h3>
|
<tt class="literal"><span class="pre">iterator_facade</span></tt> to implement most of the iterator's operations.</p>
|
||||||
<p>The first step in building a concrete iterator with iterator_facade
|
<pre class="literal-block">
|
||||||
is to decide what its template parameters will be.</p>
|
# include "node.hpp"
|
||||||
|
# include <boost/iterator/iterator_facade.hpp>
|
||||||
|
|
||||||
|
class node_iterator
|
||||||
|
: public boost::iterator_facade<...>
|
||||||
|
{
|
||||||
|
...
|
||||||
|
};
|
||||||
|
</pre>
|
||||||
|
<div class="section" id="template-arguments-for-iterator-facade">
|
||||||
|
<h3><a class="toc-backref" href="#id30" name="template-arguments-for-iterator-facade">Template Arguments for <tt class="literal"><span class="pre">iterator_facade</span></tt></a></h3>
|
||||||
|
<p><tt class="literal"><span class="pre">iterator_facade</span></tt> has several template parameters, so we must decide
|
||||||
|
what types to use for the arguments. The parameters are <tt class="literal"><span class="pre">Derived</span></tt>,
|
||||||
|
<tt class="literal"><span class="pre">Value</span></tt>, <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt>, <tt class="literal"><span class="pre">Reference</span></tt>, and <tt class="literal"><span class="pre">Difference</span></tt>.</p>
|
||||||
<div class="section" id="derived">
|
<div class="section" id="derived">
|
||||||
<h4><a class="toc-backref" href="#id31" name="derived"><tt class="literal"><span class="pre">Derived</span></tt></a></h4>
|
<h4><a class="toc-backref" href="#id31" name="derived"><tt class="literal"><span class="pre">Derived</span></tt></a></h4>
|
||||||
<p>Because <tt class="literal"><span class="pre">iterator_facade</span></tt> is meant to be used with the CRTP
|
<p>Because <tt class="literal"><span class="pre">iterator_facade</span></tt> is meant to be used with the CRTP
|
||||||
@ -1356,11 +1142,5 @@ return tmp -= n;
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr class="footer" />
|
|
||||||
<div class="footer">
|
|
||||||
<a class="reference" href="iterator_facade.rst">View document source</a>.
|
|
||||||
Generated on: 2004-01-12 02:46 UTC.
|
|
||||||
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
|
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -75,11 +75,29 @@ lists.
|
|||||||
A Basic Iterator Using ``iterator_facade``
|
A Basic Iterator Using ``iterator_facade``
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
|
|
||||||
Template Parameters
|
We will construct a ``node_iterator`` class using inheritance from
|
||||||
...................
|
``iterator_facade`` to implement most of the iterator's operations.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
# include "node.hpp"
|
||||||
|
# include <boost/iterator/iterator_facade.hpp>
|
||||||
|
|
||||||
|
class node_iterator
|
||||||
|
: public boost::iterator_facade<...>
|
||||||
|
{
|
||||||
|
...
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Template Arguments for ``iterator_facade``
|
||||||
|
..........................................
|
||||||
|
|
||||||
|
``iterator_facade`` has several template parameters, so we must decide
|
||||||
|
what types to use for the arguments. The parameters are ``Derived``,
|
||||||
|
``Value``, ``CategoryOrTraversal``, ``Reference``, and ``Difference``.
|
||||||
|
|
||||||
The first step in building a concrete iterator with iterator_facade
|
|
||||||
is to decide what its template parameters will be.
|
|
||||||
|
|
||||||
``Derived``
|
``Derived``
|
||||||
'''''''''''
|
'''''''''''
|
||||||
@ -109,7 +127,7 @@ must be a `forward traversal iterator`_. Therefore, we'll pass
|
|||||||
``boost::forward_traversal_tag`` in this position [#category]_.
|
``boost::forward_traversal_tag`` in this position [#category]_.
|
||||||
|
|
||||||
.. [#category] ``iterator_facade`` also supports old-style category
|
.. [#category] ``iterator_facade`` also supports old-style category
|
||||||
tags, so we could've passed ``std::forward_iterator_tag`` here;
|
tags, so we could have passed ``std::forward_iterator_tag`` here;
|
||||||
either way, the resulting iterator's ``iterator_category`` will
|
either way, the resulting iterator's ``iterator_category`` will
|
||||||
end up being ``std::forward_iterator_tag``.
|
end up being ``std::forward_iterator_tag``.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user