mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-10 07:33:53 +00:00
tutorial updates
[SVN r21615]
This commit is contained in:
parent
a6b2a098c1
commit
06e1fa88b9
@ -3,13 +3,240 @@
|
|||||||
<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.0: http://docutils.sourceforge.net/" />
|
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
||||||
<title>Counting Iterator</title>
|
<title>Counting 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="2004-01-12" />
|
<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" />
|
<style 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="counting-iterator">
|
<div class="document" id="counting-iterator">
|
||||||
@ -208,5 +435,11 @@ indirectly printing out the numbers from 0 to 7
|
|||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<hr class="footer" />
|
||||||
|
<div class="footer">
|
||||||
|
<a class="reference" href="counting_iterator.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>
|
||||||
|
@ -29,7 +29,7 @@ div.abstract p.topic-title {
|
|||||||
text-align: center }
|
text-align: center }
|
||||||
|
|
||||||
div.attention, div.caution, div.danger, div.error, div.hint,
|
div.attention, div.caution, div.danger, div.error, div.hint,
|
||||||
div.important, div.note, div.tip, div.warning {
|
div.important, div.note, div.tip, div.warning, div.admonition {
|
||||||
margin: 2em ;
|
margin: 2em ;
|
||||||
border: medium outset ;
|
border: medium outset ;
|
||||||
padding: 1em }
|
padding: 1em }
|
||||||
@ -42,7 +42,8 @@ div.warning p.admonition-title {
|
|||||||
font-family: sans-serif }
|
font-family: sans-serif }
|
||||||
|
|
||||||
div.hint p.admonition-title, div.important p.admonition-title,
|
div.hint p.admonition-title, div.important p.admonition-title,
|
||||||
div.note p.admonition-title, div.tip p.admonition-title {
|
div.note p.admonition-title, div.tip p.admonition-title,
|
||||||
|
div.admonition p.admonition-title {
|
||||||
font-weight: bold ;
|
font-weight: bold ;
|
||||||
font-family: sans-serif }
|
font-family: sans-serif }
|
||||||
|
|
||||||
@ -61,6 +62,19 @@ div.figure {
|
|||||||
div.footer, div.header {
|
div.footer, div.header {
|
||||||
font-size: smaller }
|
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 {
|
div.system-messages {
|
||||||
margin: 5em }
|
margin: 5em }
|
||||||
|
|
||||||
@ -105,6 +119,10 @@ ol.lowerroman {
|
|||||||
ol.upperroman {
|
ol.upperroman {
|
||||||
list-style: upper-roman }
|
list-style: upper-roman }
|
||||||
|
|
||||||
|
p.attribution {
|
||||||
|
text-align: right ;
|
||||||
|
margin-left: 50% }
|
||||||
|
|
||||||
p.caption {
|
p.caption {
|
||||||
font-style: italic }
|
font-style: italic }
|
||||||
|
|
||||||
@ -115,6 +133,21 @@ p.credits {
|
|||||||
p.label {
|
p.label {
|
||||||
white-space: nowrap }
|
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 {
|
p.topic-title {
|
||||||
font-weight: bold }
|
font-weight: bold }
|
||||||
|
|
||||||
@ -144,6 +177,9 @@ span.classifier-delimiter {
|
|||||||
span.interpreted {
|
span.interpreted {
|
||||||
font-family: sans-serif }
|
font-family: sans-serif }
|
||||||
|
|
||||||
|
span.option {
|
||||||
|
white-space: nowrap }
|
||||||
|
|
||||||
span.option-argument {
|
span.option-argument {
|
||||||
font-style: italic }
|
font-style: italic }
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -3,13 +3,240 @@
|
|||||||
<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.0: http://docutils.sourceforge.net/" />
|
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
||||||
<title>Filter Iterator</title>
|
<title>Filter 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="2004-01-11" />
|
<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" />
|
<style 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="filter-iterator">
|
<div class="document" id="filter-iterator">
|
||||||
@ -27,7 +254,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>2004-01-11</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>
|
||||||
@ -266,6 +493,8 @@ whose predicate and end are copies of <tt class="literal"><span class="pre">t.pr
|
|||||||
increment <tt class="literal"><span class="pre">*this</span></tt> until either <tt class="literal"><span class="pre">this->base()</span> <span class="pre">==</span> <span class="pre">this->end()</span></tt>
|
increment <tt class="literal"><span class="pre">*this</span></tt> until either <tt class="literal"><span class="pre">this->base()</span> <span class="pre">==</span> <span class="pre">this->end()</span></tt>
|
||||||
or <tt class="literal"><span class="pre">f(**this)</span> <span class="pre">==</span> <span class="pre">true</span></tt>.</td>
|
or <tt class="literal"><span class="pre">f(**this)</span> <span class="pre">==</span> <span class="pre">true</span></tt>.</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">*this</span></tt></td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<pre class="literal-block">
|
<pre class="literal-block">
|
||||||
@ -362,5 +591,11 @@ int main()
|
|||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<hr class="footer" />
|
||||||
|
<div class="footer">
|
||||||
|
<a class="reference" href="filter_iterator.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>
|
||||||
|
@ -3,13 +3,240 @@
|
|||||||
<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.0: http://docutils.sourceforge.net/" />
|
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
||||||
<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="2003-09-14" />
|
||||||
<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" />
|
<style 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="function-output-iterator">
|
<div class="document" id="function-output-iterator">
|
||||||
@ -155,5 +382,11 @@ return *this;
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<hr class="footer" />
|
||||||
|
<div class="footer">
|
||||||
|
<a class="reference" href="function_output_iterator.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>
|
||||||
|
237
doc/index.html
237
doc/index.html
@ -3,9 +3,236 @@
|
|||||||
<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.0: http://docutils.sourceforge.net/" />
|
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
||||||
<title>The Boost.Iterator Library Boost</title>
|
<title>The Boost.Iterator Library Boost</title>
|
||||||
<link rel="stylesheet" href="default.css" type="text/css" />
|
<style 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="the-boost-iterator-library-logo">
|
<div class="document" id="the-boost-iterator-library-logo">
|
||||||
@ -217,5 +444,11 @@ LocalWords: incrementable xxx min prev inplace png oldeqnew AccessTag struct
|
|||||||
LocalWords: TraversalTag typename lvalues DWA Hmm JGS -->
|
LocalWords: TraversalTag typename lvalues DWA Hmm JGS -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<hr class="footer" />
|
||||||
|
<div class="footer">
|
||||||
|
<a class="reference" href="index.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>
|
||||||
|
@ -3,13 +3,240 @@
|
|||||||
<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.0: http://docutils.sourceforge.net/" />
|
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
||||||
<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="2003-09-14" />
|
||||||
<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" />
|
<style 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="indirect-iterator">
|
<div class="document" id="indirect-iterator">
|
||||||
@ -196,5 +423,11 @@ indirect_iterator(
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<hr class="footer" />
|
||||||
|
<div class="footer">
|
||||||
|
<a class="reference" href="indirect_iterator.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>
|
||||||
|
@ -3,13 +3,240 @@
|
|||||||
<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.0: http://docutils.sourceforge.net/" />
|
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
||||||
<title>Iterator Adaptor</title>
|
<title>Iterator Adaptor</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="2003-09-14" />
|
||||||
<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" />
|
<style 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-adaptor">
|
<div class="document" id="iterator-adaptor">
|
||||||
@ -324,5 +551,11 @@ typename iterator_adaptor::difference_type distance_to(
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<hr class="footer" />
|
||||||
|
<div class="footer">
|
||||||
|
<a class="reference" href="iterator_adaptor.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>
|
||||||
|
@ -3,13 +3,240 @@
|
|||||||
<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.0: http://docutils.sourceforge.net/" />
|
<meta name="generator" content="Docutils 0.3.1: 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" />
|
||||||
<link rel="stylesheet" href="default.css" type="text/css" />
|
<style 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">
|
||||||
@ -45,24 +272,44 @@ and associated types, to be supplied by a derived iterator class.</td>
|
|||||||
<div class="contents topic" id="table-of-contents">
|
<div class="contents topic" id="table-of-contents">
|
||||||
<p class="topic-title"><a name="table-of-contents">Table of Contents</a></p>
|
<p class="topic-title"><a name="table-of-contents">Table of Contents</a></p>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li><a class="reference" href="#overview" id="id7" name="id7">Overview</a><ul>
|
<li><a class="reference" href="#overview" id="id20" name="id20">Overview</a><ul>
|
||||||
<li><a class="reference" href="#motivation" id="id8" name="id8">Motivation</a></li>
|
<li><a class="reference" href="#motivation" id="id21" name="id21">Motivation</a></li>
|
||||||
<li><a class="reference" href="#usage" id="id9" name="id9">Usage</a></li>
|
<li><a class="reference" href="#usage" id="id22" name="id22">Usage</a></li>
|
||||||
<li><a class="reference" href="#iterator-core-access" id="id10" name="id10">Iterator Core Access</a></li>
|
<li><a class="reference" href="#iterator-core-access" id="id23" name="id23">Iterator Core Access</a></li>
|
||||||
<li><a class="reference" href="#operator" id="id11" name="id11"><tt class="literal"><span class="pre">operator[]</span></tt></a></li>
|
<li><a class="reference" href="#operator" id="id24" name="id24"><tt class="literal"><span class="pre">operator[]</span></tt></a></li>
|
||||||
<li><a class="reference" href="#id2" id="id12" name="id12"><tt class="literal"><span class="pre">operator-></span></tt></a></li>
|
<li><a class="reference" href="#id2" id="id25" name="id25"><tt class="literal"><span class="pre">operator-></span></tt></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="reference" href="#tutorial-example" id="id13" name="id13">Tutorial Example</a><ul>
|
<li><a class="reference" href="#tutorial-example" id="id26" name="id26">Tutorial Example</a><ul>
|
||||||
<li><a class="reference" href="#introduction" id="id14" name="id14">Introduction</a></li>
|
<li><a class="reference" href="#introduction" id="id27" name="id27">Introduction</a></li>
|
||||||
<li><a class="reference" href="#the-problem" id="id15" name="id15">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="#template-parameters" id="id30" name="id30">Template Parameters</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="#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="#reference" id="id34" name="id34"><tt class="literal"><span class="pre">Reference</span></tt></a></li>
|
||||||
|
<li><a class="reference" href="#difference" id="id35" name="id35"><tt class="literal"><span class="pre">Difference</span></tt></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="reference" href="#reference" id="id16" name="id16">Reference</a><ul>
|
<li><a class="reference" href="#constructors-and-data-members" id="id36" name="id36">Constructors and Data Members</a></li>
|
||||||
<li><a class="reference" href="#ref" id="id17" name="id17">Ref</a><ul>
|
<li><a class="reference" href="#core-operations" id="id37" name="id37">Core Operations</a></li>
|
||||||
<li><a class="reference" href="#iterator-facade-usage" id="id18" name="id18"><tt class="literal"><span class="pre">iterator_facade</span></tt> usage</a></li>
|
</ul>
|
||||||
<li><a class="reference" href="#iterator-facade-iterator-category" id="id19" name="id19"><tt class="literal"><span class="pre">iterator_facade</span></tt> iterator category</a></li>
|
</li>
|
||||||
<li><a class="reference" href="#iterator-facade-operations" id="id20" name="id20"><tt class="literal"><span class="pre">iterator_facade</span></tt> operations</a></li>
|
<li><a class="reference" href="#a-constant-node-iterator" id="id38" name="id38">A constant <tt class="literal"><span class="pre">node_iterator</span></tt></a></li>
|
||||||
|
<li><a class="reference" href="#interoperability" id="id39" name="id39">Interoperability</a></li>
|
||||||
|
<li><a class="reference" href="#telling-the-truth" id="id40" name="id40">Telling the Truth</a></li>
|
||||||
|
<li><a class="reference" href="#wrap-up" id="id41" name="id41">Wrap Up</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><a class="reference" href="#id14" id="id42" name="id42">Reference</a><ul>
|
||||||
|
<li><a class="reference" href="#ref" id="id43" name="id43">Ref</a><ul>
|
||||||
|
<li><a class="reference" href="#iterator-facade-usage" id="id44" name="id44"><tt class="literal"><span class="pre">iterator_facade</span></tt> usage</a><ul>
|
||||||
|
<li><a class="reference" href="#iterator-facade-core-operations" id="id45" name="id45"><tt class="literal"><span class="pre">iterator_facade</span></tt> Core Operations</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><a class="reference" href="#iterator-facade-iterator-category" id="id46" name="id46"><tt class="literal"><span class="pre">iterator_facade</span></tt> iterator category</a></li>
|
||||||
|
<li><a class="reference" href="#iterator-facade-operations" id="id47" name="id47"><tt class="literal"><span class="pre">iterator_facade</span></tt> operations</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -70,9 +317,9 @@ and associated types, to be supplied by a derived iterator class.</td>
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="overview">
|
<div class="section" id="overview">
|
||||||
<h1><a class="toc-backref" href="#id7" name="overview">Overview</a></h1>
|
<h1><a class="toc-backref" href="#id20" name="overview">Overview</a></h1>
|
||||||
<div class="section" id="motivation">
|
<div class="section" id="motivation">
|
||||||
<h2><a class="toc-backref" href="#id8" name="motivation">Motivation</a></h2>
|
<h2><a class="toc-backref" href="#id21" name="motivation">Motivation</a></h2>
|
||||||
<!-- Version 1.1 of this ReStructuredText document corresponds to
|
<!-- Version 1.1 of this ReStructuredText document corresponds to
|
||||||
n1530_, the paper accepted by the LWG for TR1. -->
|
n1530_, the paper accepted by the LWG for TR1. -->
|
||||||
<!-- Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All
|
<!-- Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All
|
||||||
@ -116,7 +363,7 @@ impossible.</li>
|
|||||||
</blockquote>
|
</blockquote>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="usage">
|
<div class="section" id="usage">
|
||||||
<h2><a class="toc-backref" href="#id9" name="usage">Usage</a></h2>
|
<h2><a class="toc-backref" href="#id22" name="usage">Usage</a></h2>
|
||||||
<p>The user of <tt class="literal"><span class="pre">iterator_facade</span></tt> derives his iterator class from a
|
<p>The user of <tt class="literal"><span class="pre">iterator_facade</span></tt> derives his iterator class from a
|
||||||
specialization of <tt class="literal"><span class="pre">iterator_facade</span></tt> and passes the derived
|
specialization of <tt class="literal"><span class="pre">iterator_facade</span></tt> and passes the derived
|
||||||
iterator class as <tt class="literal"><span class="pre">iterator_facade</span></tt>'s first template parameter.
|
iterator class as <tt class="literal"><span class="pre">iterator_facade</span></tt>'s first template parameter.
|
||||||
@ -180,7 +427,7 @@ Iterator or a more-refined iterator concept, a default constructor is
|
|||||||
required.</p>
|
required.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="iterator-core-access">
|
<div class="section" id="iterator-core-access">
|
||||||
<h2><a class="toc-backref" href="#id10" name="iterator-core-access">Iterator Core Access</a></h2>
|
<h2><a class="toc-backref" href="#id23" name="iterator-core-access">Iterator Core Access</a></h2>
|
||||||
<p><tt class="literal"><span class="pre">iterator_facade</span></tt> and the operator implementations need to be able
|
<p><tt class="literal"><span class="pre">iterator_facade</span></tt> and the operator implementations need to be able
|
||||||
to access the core member functions in the derived class. Making the
|
to access the core member functions in the derived class. Making the
|
||||||
core member functions public would expose an implementation detail to
|
core member functions public would expose an implementation detail to
|
||||||
@ -214,7 +461,7 @@ open a safety loophole, as every core member function preserves the
|
|||||||
invariants of the iterator.</p>
|
invariants of the iterator.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="operator">
|
<div class="section" id="operator">
|
||||||
<h2><a class="toc-backref" href="#id11" name="operator"><tt class="literal"><span class="pre">operator[]</span></tt></a></h2>
|
<h2><a class="toc-backref" href="#id24" name="operator"><tt class="literal"><span class="pre">operator[]</span></tt></a></h2>
|
||||||
<p>The indexing operator for a generalized iterator presents special
|
<p>The indexing operator for a generalized iterator presents special
|
||||||
challenges. A random access iterator's <tt class="literal"><span class="pre">operator[]</span></tt> is only
|
challenges. A random access iterator's <tt class="literal"><span class="pre">operator[]</span></tt> is only
|
||||||
required to return something convertible to its <tt class="literal"><span class="pre">value_type</span></tt>.
|
required to return something convertible to its <tt class="literal"><span class="pre">value_type</span></tt>.
|
||||||
@ -237,7 +484,7 @@ class; it will hide the one supplied by <tt class="literal"><span class="pre">it
|
|||||||
clients of her iterator.</p>
|
clients of her iterator.</p>
|
||||||
<a class="target" id="operator-arrow" name="operator-arrow"></a></div>
|
<a class="target" id="operator-arrow" name="operator-arrow"></a></div>
|
||||||
<div class="section" id="id2">
|
<div class="section" id="id2">
|
||||||
<h2><a class="toc-backref" href="#id12" name="id2"><tt class="literal"><span class="pre">operator-></span></tt></a></h2>
|
<h2><a class="toc-backref" href="#id25" name="id2"><tt class="literal"><span class="pre">operator-></span></tt></a></h2>
|
||||||
<p>The <tt class="literal"><span class="pre">reference</span></tt> type of a readable iterator (and today's input
|
<p>The <tt class="literal"><span class="pre">reference</span></tt> type of a readable iterator (and today's input
|
||||||
iterator) need not in fact be a reference, so long as it is
|
iterator) need not in fact be a reference, so long as it is
|
||||||
convertible to the iterator's <tt class="literal"><span class="pre">value_type</span></tt>. When the <tt class="literal"><span class="pre">value_type</span></tt>
|
convertible to the iterator's <tt class="literal"><span class="pre">value_type</span></tt>. When the <tt class="literal"><span class="pre">value_type</span></tt>
|
||||||
@ -252,26 +499,26 @@ specialization to meet the requirements of its <tt class="literal"><span class="
|
|||||||
<colgroup><col class="label" /><col /></colgroup>
|
<colgroup><col class="label" /><col /></colgroup>
|
||||||
<col />
|
<col />
|
||||||
<tbody valign="top">
|
<tbody valign="top">
|
||||||
<tr><td class="label"><a class="fn-backref" href="#id1" name="cop95">[Cop95]</a></td><td>[Coplien, 1995] Coplien, J., Curiously Recurring Template
|
<tr><td class="label"><a name="cop95">[Cop95]</a></td><td><em>(<a class="fn-backref" href="#id1">1</a>, <a class="fn-backref" href="#id3">2</a>)</em> [Coplien, 1995] Coplien, J., Curiously Recurring Template
|
||||||
Patterns, C++ Report, February 1995, pp. 24-27.</td></tr>
|
Patterns, C++ Report, February 1995, pp. 24-27.</td></tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="tutorial-example">
|
<div class="section" id="tutorial-example">
|
||||||
<h1><a class="toc-backref" href="#id13" name="tutorial-example">Tutorial Example</a></h1>
|
<h1><a class="toc-backref" href="#id26" name="tutorial-example">Tutorial Example</a></h1>
|
||||||
<!-- Copyright David Abrahams 2004. Use, modification and distribution is -->
|
<!-- Copyright David Abrahams 2004. Use, modification and distribution is -->
|
||||||
<!-- subject to the Boost Software License, Version 1.0. (See accompanying -->
|
<!-- subject to the Boost Software License, Version 1.0. (See accompanying -->
|
||||||
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
||||||
<div class="section" id="introduction">
|
<div class="section" id="introduction">
|
||||||
<h2><a class="toc-backref" href="#id14" name="introduction">Introduction</a></h2>
|
<h2><a class="toc-backref" href="#id27" name="introduction">Introduction</a></h2>
|
||||||
<p>In this section we'll walk through the implementation of a few
|
<p>In this section we'll walk through the implementation of a few
|
||||||
iterators using <tt class="literal"><span class="pre">iterator_facade</span></tt>, based around the simple
|
iterators using <tt class="literal"><span class="pre">iterator_facade</span></tt>, based around the simple
|
||||||
example of a linked list of polymorphic objects.</p>
|
example of a linked list of polymorphic objects.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="the-problem">
|
<div class="section" id="the-problem">
|
||||||
<h2><a class="toc-backref" href="#id15" name="the-problem">The Problem</a></h2>
|
<h2><a class="toc-backref" href="#id28" name="the-problem">The Problem</a></h2>
|
||||||
<p>Say we've written a polymorphic linked list node as follows:</p>
|
<p>Say we've written a polymorphic linked list node base class:</p>
|
||||||
<pre class="literal-block">
|
<pre class="literal-block">
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
|
|
||||||
@ -279,15 +526,17 @@ struct node_base
|
|||||||
{
|
{
|
||||||
node_base() : m_next(0) {}
|
node_base() : m_next(0) {}
|
||||||
|
|
||||||
|
// Each node manages all of its tail nodes
|
||||||
virtual ~node_base() { delete m_next; }
|
virtual ~node_base() { delete m_next; }
|
||||||
|
|
||||||
|
// Access the rest of the list
|
||||||
node_base* next() const { return m_next; }
|
node_base* next() const { return m_next; }
|
||||||
|
|
||||||
// print to the stream
|
// print to the stream
|
||||||
virtual void print(std::ostream& s) const = 0;
|
virtual void print(std::ostream& s) const = 0;
|
||||||
|
|
||||||
// double the value
|
// double the value
|
||||||
virtual void twice() = 0;
|
virtual void double_me() = 0;
|
||||||
|
|
||||||
void append(node_base* p)
|
void append(node_base* p)
|
||||||
{
|
{
|
||||||
@ -312,7 +561,7 @@ struct node : node_base
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
void print(std::ostream& s) const { s << this->m_value; }
|
void print(std::ostream& s) const { s << this->m_value; }
|
||||||
void twice() { m_value += m_value; }
|
void double_me() { m_value += m_value; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T m_value;
|
T m_value;
|
||||||
@ -326,16 +575,398 @@ inline std::ostream& operator<<(std::ostream& s, node_base const&a
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
<div class="sidebar">
|
<p>Our first challenge is to build an appropriate iterator over these
|
||||||
<p class="sidebar-title">Note</p>
|
lists.</p>
|
||||||
<p>This is in progress; check the ../example directory for code.</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
<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>
|
||||||
|
<div class="section" id="template-parameters">
|
||||||
|
<h3><a class="toc-backref" href="#id30" name="template-parameters">Template Parameters</a></h3>
|
||||||
|
<p>The first step in building a concrete iterator with iterator_facade
|
||||||
|
is to decide what its template parameters will be.</p>
|
||||||
|
<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>
|
||||||
|
<p>Because <tt class="literal"><span class="pre">iterator_facade</span></tt> is meant to be used with the CRTP
|
||||||
|
<a class="citation-reference" href="#cop95" id="id3" name="id3">[Cop95]</a> the first parameter is the iterator class name itself,
|
||||||
|
<tt class="literal"><span class="pre">node_iterator</span></tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="section" id="value">
|
||||||
|
<h4><a class="toc-backref" href="#id32" name="value"><tt class="literal"><span class="pre">Value</span></tt></a></h4>
|
||||||
|
<p>The <tt class="literal"><span class="pre">Value</span></tt> parameter determines the <tt class="literal"><span class="pre">node_iterator</span></tt>'s
|
||||||
|
<tt class="literal"><span class="pre">value_type</span></tt>. In this case, we are iterating over <tt class="literal"><span class="pre">node_base</span></tt>
|
||||||
|
objects, so <tt class="literal"><span class="pre">Value</span></tt> will be <tt class="literal"><span class="pre">node_base</span></tt>.</p>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="categoryortraversal">
|
||||||
|
<h4><a class="toc-backref" href="#id33" name="categoryortraversal"><tt class="literal"><span class="pre">CategoryOrTraversal</span></tt></a></h4>
|
||||||
|
<p>Now we have to determine which <a class="reference" href="new-iter-concepts.html#iterator-traversal-concepts-lib-iterator-traversal">iterator traversal concept</a> our
|
||||||
|
<tt class="literal"><span class="pre">node_iterator</span></tt> is going to model. Singly-linked lists only have
|
||||||
|
forward links, so our iterator can't can't be a <a class="reference" href="new-iter-concepts.html#bidirectional-traversal-iterators-lib-bidirectional-traversal-iterators">bidirectional
|
||||||
|
traversal iterator</a>. Our iterator should be able to make multiple
|
||||||
|
passes over the same linked list (unlike, say, an
|
||||||
|
<tt class="literal"><span class="pre">istream_iterator</span></tt> which consumes the stream it traverses), so it
|
||||||
|
must be a <a class="reference" href="new-iter-concepts.html#forward-traversal-iterators-lib-forward-traversal-iterators">forward traversal iterator</a>. Therefore, we'll pass
|
||||||
|
<tt class="literal"><span class="pre">boost::forward_traversal_tag</span></tt> in this position <a class="footnote-reference" href="#category" id="id4" name="id4"><sup>1</sup></a>.</p>
|
||||||
|
<table class="footnote" frame="void" id="category" rules="none">
|
||||||
|
<colgroup><col class="label" /><col /></colgroup>
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr><td class="label"><a class="fn-backref" href="#id4" name="category">[1]</a></td><td><tt class="literal"><span class="pre">iterator_facade</span></tt> also supports old-style category
|
||||||
|
tags, so we could've passed <tt class="literal"><span class="pre">std::forward_iterator_tag</span></tt> here;
|
||||||
|
either way, the resulting iterator's <tt class="literal"><span class="pre">iterator_category</span></tt> will
|
||||||
|
end up being <tt class="literal"><span class="pre">std::forward_iterator_tag</span></tt>.</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="reference">
|
<div class="section" id="reference">
|
||||||
<h1><a class="toc-backref" href="#id16" name="reference">Reference</a></h1>
|
<h4><a class="toc-backref" href="#id34" name="reference"><tt class="literal"><span class="pre">Reference</span></tt></a></h4>
|
||||||
|
<p>The <tt class="literal"><span class="pre">Reference</span></tt> argument becomes the type returned by
|
||||||
|
<tt class="literal"><span class="pre">node_iterator</span></tt>'s dereference operation, and will also be the
|
||||||
|
same as <tt class="literal"><span class="pre">std::iterator_traits<node_iterator>::reference</span></tt>. The
|
||||||
|
library's default for this parameter is <tt class="literal"><span class="pre">Value&</span></tt>; since
|
||||||
|
<tt class="literal"><span class="pre">node_base&</span></tt> is a good choice for the iterator's <tt class="literal"><span class="pre">reference</span></tt>
|
||||||
|
type, we can omit this argument, or pass <tt class="literal"><span class="pre">use_default</span></tt>.</p>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="difference">
|
||||||
|
<h4><a class="toc-backref" href="#id35" name="difference"><tt class="literal"><span class="pre">Difference</span></tt></a></h4>
|
||||||
|
<p>The <tt class="literal"><span class="pre">Difference</span></tt> argument determines how the distance between
|
||||||
|
two <tt class="literal"><span class="pre">node_iterator</span></tt>s will be measured and will also be the
|
||||||
|
same as <tt class="literal"><span class="pre">std::iterator_traits<node_iterator>::difference_type</span></tt>.
|
||||||
|
The library's default for <tt class="literal"><span class="pre">Difference</span></tt> is <tt class="literal"><span class="pre">std::ptrdiff_t</span></tt>, an
|
||||||
|
appropriate type for measuring the distance between any two
|
||||||
|
addresses in memory, and one that works for almost any iterator,
|
||||||
|
so we can omit this argument, too.</p>
|
||||||
|
<p>The declaration of <tt class="literal"><span class="pre">node_iterator</span></tt> will therefore look something
|
||||||
|
like:</p>
|
||||||
|
<pre class="literal-block">
|
||||||
|
# include "node.hpp"
|
||||||
|
# include <boost/iterator/iterator_facade.hpp>
|
||||||
|
|
||||||
|
class node_iterator
|
||||||
|
: public boost::iterator_facade<
|
||||||
|
node_iterator
|
||||||
|
, node_base
|
||||||
|
, boost::forward_traversal_tag
|
||||||
|
>
|
||||||
|
{
|
||||||
|
...
|
||||||
|
};
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="constructors-and-data-members">
|
||||||
|
<h3><a class="toc-backref" href="#id36" name="constructors-and-data-members">Constructors and Data Members</a></h3>
|
||||||
|
<p>Next we need to decide how to represent the iterator's position.
|
||||||
|
This representation will take the form of data members, so we'll
|
||||||
|
also need to write constructors to initialize them. The
|
||||||
|
<tt class="literal"><span class="pre">node_iterator</span></tt>'s position is quite naturally represented using
|
||||||
|
a pointer to a <tt class="literal"><span class="pre">node_base</span></tt>. We'll need a constructor to build an
|
||||||
|
iterator from a <tt class="literal"><span class="pre">node_base*</span></tt>, and a default constructor to
|
||||||
|
satisfy the <a class="reference" href="new-iter-concepts.html#forward-traversal-iterators-lib-forward-traversal-iterators">forward traversal iterator</a> requirements <a class="footnote-reference" href="#default" id="id5" name="id5"><sup>2</sup></a>.
|
||||||
|
Our <tt class="literal"><span class="pre">node_iterator</span></tt> then becomes:</p>
|
||||||
|
<pre class="literal-block">
|
||||||
|
# include "node.hpp"
|
||||||
|
# include <boost/iterator/iterator_facade.hpp>
|
||||||
|
|
||||||
|
class node_iterator
|
||||||
|
: public boost::iterator_facade<
|
||||||
|
node_iterator
|
||||||
|
, node_base
|
||||||
|
, boost::forward_traversal_tag
|
||||||
|
>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
node_iterator()
|
||||||
|
: m_node(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
explicit node_iterator(node_base* p)
|
||||||
|
: m_node(p)
|
||||||
|
{}
|
||||||
|
|
||||||
|
private:
|
||||||
|
...
|
||||||
|
node_base* m_node;
|
||||||
|
};
|
||||||
|
</pre>
|
||||||
|
<table class="footnote" frame="void" id="default" rules="none">
|
||||||
|
<colgroup><col class="label" /><col /></colgroup>
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr><td class="label"><a class="fn-backref" href="#id5" name="default">[2]</a></td><td>Technically, the C++ standard places almost no
|
||||||
|
requirements on a default-constructed iterator, so if we were
|
||||||
|
really concerned with efficiency, we could've written the
|
||||||
|
default constructor to leave <tt class="literal"><span class="pre">m_node</span></tt> uninitialized.</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="core-operations">
|
||||||
|
<h3><a class="toc-backref" href="#id37" name="core-operations">Core Operations</a></h3>
|
||||||
|
<p>The last step is to implement the <a class="reference" href="#id18">core operations</a> required by
|
||||||
|
the concepts we want our iterator to model. Referring to the
|
||||||
|
<a class="reference" href="#id18">table</a>, we can see that the first three rows are applicable
|
||||||
|
because <tt class="literal"><span class="pre">node_iterator</span></tt> needs to satisfy the requirements for
|
||||||
|
<a class="reference" href="new-iter-concepts.html#readable-iterators-lib-readable-iterators">readable iterator</a>, <a class="reference" href="new-iter-concepts.html#single-pass-iterators-lib-single-pass-iterators">single pass iterator</a>, and <a class="reference" href="new-iter-concepts.html#incrementable-iterators-lib-incrementable-iterators">incrementable
|
||||||
|
iterator</a>.</p>
|
||||||
|
<p>We therefore need to supply <tt class="literal"><span class="pre">dereference</span></tt>,
|
||||||
|
<tt class="literal"><span class="pre">equal</span></tt>, and <tt class="literal"><span class="pre">increment</span></tt> members. We don't want these members
|
||||||
|
to become part of <tt class="literal"><span class="pre">node_iterator</span></tt>'s public interface, so we can
|
||||||
|
make them private and grant friendship to
|
||||||
|
<tt class="literal"><span class="pre">boost::iterator_core_access</span></tt>, a "back-door" that
|
||||||
|
<tt class="literal"><span class="pre">iterator_facade</span></tt> uses to get access to the core operations:</p>
|
||||||
|
<pre class="literal-block">
|
||||||
|
# include "node.hpp"
|
||||||
|
# include <boost/iterator/iterator_facade.hpp>
|
||||||
|
|
||||||
|
class node_iterator
|
||||||
|
: public boost::iterator_facade<
|
||||||
|
node_iterator
|
||||||
|
, node_base
|
||||||
|
, boost::forward_traversal_tag
|
||||||
|
>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
node_iterator()
|
||||||
|
: m_node(0) {}
|
||||||
|
|
||||||
|
explicit node_iterator(node_base* p)
|
||||||
|
: m_node(p) {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class boost::iterator_core_access;
|
||||||
|
|
||||||
|
void increment() { m_node = m_node->next(); }
|
||||||
|
|
||||||
|
bool equal(node_iterator const& other) const
|
||||||
|
{
|
||||||
|
return this->m_node == other.m_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
node_base& dereference() const { return *m_node; }
|
||||||
|
|
||||||
|
node_base* m_node;
|
||||||
|
};
|
||||||
|
</pre>
|
||||||
|
<p>Voilà; a complete and conforming readable, forward-traversal
|
||||||
|
iterator! For a working example of its use, see <a class="reference" href="../example/node_iterator1.cpp">this program</a>.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="a-constant-node-iterator">
|
||||||
|
<h2><a class="toc-backref" href="#id38" name="a-constant-node-iterator">A constant <tt class="literal"><span class="pre">node_iterator</span></tt></a></h2>
|
||||||
|
<div class="sidebar">
|
||||||
|
<p class="sidebar-title">Constant and Mutable iterators</p>
|
||||||
|
<p>The term <strong>mutable iterator</strong> means an iterator through which
|
||||||
|
the object it references (its "referent") can be modified. A
|
||||||
|
<strong>constant iterator</strong> is one which doesn't allow modification of
|
||||||
|
its referent.</p>
|
||||||
|
<p>The words <em>constant</em> and <em>mutable</em> don't refer to the ability to
|
||||||
|
modify the iterator itself. For example, an <tt class="literal"><span class="pre">int</span> <span class="pre">const*</span></tt> is a
|
||||||
|
non-<tt class="literal"><span class="pre">const</span></tt> <em>constant iterator</em>, which can be incremented
|
||||||
|
but doesn't allow modification of its referent, and <tt class="literal"><span class="pre">int*</span>
|
||||||
|
<span class="pre">const</span></tt> is a <tt class="literal"><span class="pre">const</span></tt> <em>mutable iterator</em>, which cannot be
|
||||||
|
modified but which allows modification of its referent.</p>
|
||||||
|
<p>Confusing? We agree, but those are the standard terms. It
|
||||||
|
probably doesn't help much that a container's constant iterator
|
||||||
|
is called <tt class="literal"><span class="pre">const_iterator</span></tt>.</p>
|
||||||
|
</div>
|
||||||
|
<p>Now, our <tt class="literal"><span class="pre">node_iterator</span></tt> gives clients access to both <tt class="literal"><span class="pre">node</span></tt>'s <tt class="literal"><span class="pre">print(std::ostream&)</span> <span class="pre">const</span></tt> member function, but also its
|
||||||
|
mutating <tt class="literal"><span class="pre">double_me()</span></tt> member. If we wanted to build a
|
||||||
|
<em>constant</em> <tt class="literal"><span class="pre">node_iterator</span></tt>, we'd only have to make three
|
||||||
|
changes:</p>
|
||||||
|
<pre class="literal-block">
|
||||||
|
class const_node_iterator
|
||||||
|
: public boost::iterator_facade<
|
||||||
|
node_iterator
|
||||||
|
, node_base <strong>const</strong>
|
||||||
|
, boost::forward_traversal_tag
|
||||||
|
>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
const_node_iterator()
|
||||||
|
: m_node(0) {}
|
||||||
|
|
||||||
|
explicit const_node_iterator(node_base* p)
|
||||||
|
: m_node(p) {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class boost::iterator_core_access;
|
||||||
|
|
||||||
|
void increment() { m_node = m_node->next(); }
|
||||||
|
|
||||||
|
bool equal(const_node_iterator const& other) const
|
||||||
|
{
|
||||||
|
return this->m_node == other.m_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
node_base <strong>const</strong>& dereference() const { return *m_node; }
|
||||||
|
|
||||||
|
node_base <strong>const</strong>* m_node;
|
||||||
|
};
|
||||||
|
</pre>
|
||||||
|
<div class="sidebar">
|
||||||
|
<p class="sidebar-title"><tt class="literal"><span class="pre">const</span></tt> and an iterator's <tt class="literal"><span class="pre">value_type</span></tt></p>
|
||||||
|
<p>The C++ standard requires an iterator's <tt class="literal"><span class="pre">value_type</span></tt> <em>not</em> be
|
||||||
|
<tt class="literal"><span class="pre">const</span></tt>-qualified, so <tt class="literal"><span class="pre">iterator_facade</span></tt> strips the
|
||||||
|
<tt class="literal"><span class="pre">const</span></tt> from its <tt class="literal"><span class="pre">Value</span></tt> parameter in order to produce the
|
||||||
|
iterator's <tt class="literal"><span class="pre">value_type</span></tt>. Making the <tt class="literal"><span class="pre">Value</span></tt> argument
|
||||||
|
<tt class="literal"><span class="pre">const</span></tt> provides a useful hint to <tt class="literal"><span class="pre">iterator_facade</span></tt> that the
|
||||||
|
iterator is a <em>constant iterator</em>, and the default <tt class="literal"><span class="pre">Reference</span></tt>
|
||||||
|
argument will be correct for all lvalue iterators.</p>
|
||||||
|
</div>
|
||||||
|
<p>As a matter of fact, <tt class="literal"><span class="pre">node_iterator</span></tt> and <tt class="literal"><span class="pre">const_node_iterator</span></tt>
|
||||||
|
are so similar that it makes sense to factor the common code out
|
||||||
|
into a template as follows:</p>
|
||||||
|
<pre class="literal-block">
|
||||||
|
template <class Value>
|
||||||
|
class node_iter
|
||||||
|
: public boost::iterator_facade<
|
||||||
|
node_iter<Value>
|
||||||
|
, Value
|
||||||
|
, boost::forward_traversal_tag
|
||||||
|
>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
node_iter()
|
||||||
|
: m_node(0) {}
|
||||||
|
|
||||||
|
explicit node_iter(Value* p)
|
||||||
|
: m_node(p) {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class boost::iterator_core_access;
|
||||||
|
|
||||||
|
bool equal(node_iter<Value> const& other) const
|
||||||
|
{
|
||||||
|
return this->m_node == other.m_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
void increment()
|
||||||
|
{ m_node = m_node->next(); }
|
||||||
|
|
||||||
|
Value& dereference() const
|
||||||
|
{ return *m_node; }
|
||||||
|
|
||||||
|
Value* m_node;
|
||||||
|
};
|
||||||
|
typedef node_iter<node_base> node_iterator;
|
||||||
|
typedef node_iter<node_base const> node_const_iterator;
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="interoperability">
|
||||||
|
<h2><a class="toc-backref" href="#id39" name="interoperability">Interoperability</a></h2>
|
||||||
|
<p>Our <tt class="literal"><span class="pre">const_node_iterator</span></tt> works perfectly well on its own, but
|
||||||
|
taken together with <tt class="literal"><span class="pre">node_iterator</span></tt> it doesn't quite meet
|
||||||
|
expectations. For example, we'd like to be able to pass a
|
||||||
|
<tt class="literal"><span class="pre">node_iterator</span></tt> where a <tt class="literal"><span class="pre">node_const_iterator</span></tt> was expected,
|
||||||
|
just as you can with <tt class="literal"><span class="pre">std::list<int></span></tt>'s <tt class="literal"><span class="pre">iterator</span></tt> and
|
||||||
|
<tt class="literal"><span class="pre">const_iterator</span></tt>. Furthermore, given a <tt class="literal"><span class="pre">node_iterator</span></tt> and a
|
||||||
|
<tt class="literal"><span class="pre">node_const_iterator</span></tt> into the same list, we should be able to
|
||||||
|
compare them for equality.</p>
|
||||||
|
<p>This expected ability to use two different iterator types together
|
||||||
|
is known as <strong>interoperability</strong>. Achieving interoperability in
|
||||||
|
our case is as simple as templatizing the <tt class="literal"><span class="pre">equal</span></tt> function and
|
||||||
|
adding a templatized converting constructor <a class="footnote-reference" href="#broken" id="id8" name="id8"><sup>3</sup></a> <a class="footnote-reference" href="#random" id="id9" name="id9"><sup>4</sup></a>:</p>
|
||||||
|
<pre class="literal-block">
|
||||||
|
template <class Value>
|
||||||
|
class node_iter
|
||||||
|
: public boost::iterator_facade<
|
||||||
|
node_iter<Value>
|
||||||
|
, Value
|
||||||
|
, boost::forward_traversal_tag
|
||||||
|
>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
node_iter()
|
||||||
|
: m_node(0) {}
|
||||||
|
|
||||||
|
explicit node_iter(Value* p)
|
||||||
|
: m_node(p) {}
|
||||||
|
|
||||||
|
template <class OtherValue>
|
||||||
|
node_iter(node_iter<OtherValue> const& other)
|
||||||
|
: m_node(other.m_node) {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class boost::iterator_core_access;
|
||||||
|
template <class> friend class node_iter;
|
||||||
|
|
||||||
|
template <class OtherValue>
|
||||||
|
bool equal(node_iter<OtherValue> const& other) const
|
||||||
|
{
|
||||||
|
return this->m_node == other.m_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
void increment()
|
||||||
|
{ m_node = m_node->next(); }
|
||||||
|
|
||||||
|
Value& dereference() const
|
||||||
|
{ return *m_node; }
|
||||||
|
|
||||||
|
Value* m_node;
|
||||||
|
};
|
||||||
|
typedef impl::node_iterator<node_base> node_iterator;
|
||||||
|
typedef impl::node_iterator<node_base const> node_const_iterator;
|
||||||
|
</pre>
|
||||||
|
<table class="footnote" frame="void" id="broken" rules="none">
|
||||||
|
<colgroup><col class="label" /><col /></colgroup>
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr><td class="label"><a class="fn-backref" href="#id8" name="broken">[3]</a></td><td>If you're using an older compiler and it can't handle
|
||||||
|
this example, see the <a class="reference" href="../example/node_iterator2.hpp">example code</a> for workarounds.</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<table class="footnote" frame="void" id="random" rules="none">
|
||||||
|
<colgroup><col class="label" /><col /></colgroup>
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr><td class="label"><a class="fn-backref" href="#id9" name="random">[4]</a></td><td>If <tt class="literal"><span class="pre">node_iterator</span></tt> had been a <a class="reference" href="new-iter-concepts.html#random-access-traversal-iterators-lib-random-access-traversal-iterators">random access
|
||||||
|
traversal iterator</a>, we'd have had to templatize its
|
||||||
|
<tt class="literal"><span class="pre">distance_to</span></tt> function as well.</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>You can see an example program which exercises our interoperable
|
||||||
|
iterators <a class="reference" href="../example/node_iterator2.cpp">here</a>.</p>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="telling-the-truth">
|
||||||
|
<h2><a class="toc-backref" href="#id40" name="telling-the-truth">Telling the Truth</a></h2>
|
||||||
|
<p>Now <tt class="literal"><span class="pre">node_iterator</span></tt> and <tt class="literal"><span class="pre">node_const_iterator</span></tt> behave exactly as
|
||||||
|
you'd expect... almost. We can compare them and we can convert in
|
||||||
|
one direction: from <tt class="literal"><span class="pre">node_iterator</span></tt> to <tt class="literal"><span class="pre">node_const_iterator</span></tt>.
|
||||||
|
If we try to convert from <tt class="literal"><span class="pre">node_const_iterator</span></tt> to
|
||||||
|
<tt class="literal"><span class="pre">node_iterator</span></tt>, we'll get an error when the converting
|
||||||
|
constructor tries to initialize <tt class="literal"><span class="pre">node_iterator</span></tt>'s <tt class="literal"><span class="pre">m_node</span></tt>, a
|
||||||
|
<tt class="literal"><span class="pre">node*</span></tt> with a <tt class="literal"><span class="pre">node</span> <span class="pre">const*</span></tt>. So what's the problem?</p>
|
||||||
|
<p>The problem is that
|
||||||
|
<tt class="literal"><span class="pre">boost::</span></tt><a class="reference" href="../../type_traits/index.html#relationships"><tt class="literal"><span class="pre">is_convertible</span></tt></a><tt class="literal"><span class="pre"><node_const_iterator,node_iterator>::value</span></tt>
|
||||||
|
will be <tt class="literal"><span class="pre">true</span></tt>, but it should be <tt class="literal"><span class="pre">false</span></tt>. <a class="reference" href="../../type_traits/index.html#relationships"><tt class="literal"><span class="pre">is_convertible</span></tt></a>
|
||||||
|
lies because it can only see as far as the <em>declaration</em> of
|
||||||
|
<tt class="literal"><span class="pre">node_iter</span></tt>'s converting constructor, but can't look inside at
|
||||||
|
the <em>definition</em> to make sure it will compile. A perfect solution
|
||||||
|
would make <tt class="literal"><span class="pre">node_iter</span></tt>'s converting constructor disappear when
|
||||||
|
the <tt class="literal"><span class="pre">m_node</span></tt> conversion would fail.</p>
|
||||||
|
<p>In fact, that sort of magic is possible using
|
||||||
|
<a class="reference" href="../../utility/enable_if.html"><tt class="literal"><span class="pre">boost::enable_if</span></tt></a>. By rewriting the converting constructor as
|
||||||
|
follows, we can remove it from the overload set when it's not
|
||||||
|
appropriate:</p>
|
||||||
|
<pre class="literal-block">
|
||||||
|
template <class OtherValue>
|
||||||
|
node_iter(
|
||||||
|
node_iter<OtherValue> const& other
|
||||||
|
, typename boost::enable_if<
|
||||||
|
boost::is_convertible<OtherValue*,Value*>
|
||||||
|
, enabler
|
||||||
|
>::type = enabler()
|
||||||
|
)
|
||||||
|
: m_node(other.m_node) {}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="wrap-up">
|
||||||
|
<h2><a class="toc-backref" href="#id41" name="wrap-up">Wrap Up</a></h2>
|
||||||
|
<p>This concludes our <tt class="literal"><span class="pre">iterator_facade</span></tt> tutorial, but before you
|
||||||
|
stop reading we urge you to take a look at <a class="reference" href="iterator_adaptor.html"><tt class="literal"><span class="pre">iterator_adaptor</span></tt></a>.
|
||||||
|
There's another way to approach writing these iterators which might
|
||||||
|
even be superior.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="id14">
|
||||||
|
<h1><a class="toc-backref" href="#id42" name="id14">Reference</a></h1>
|
||||||
<div class="section" id="ref">
|
<div class="section" id="ref">
|
||||||
<h2><a class="toc-backref" href="#id17" name="ref">Ref</a></h2>
|
<h2><a class="toc-backref" href="#id43" name="ref">Ref</a></h2>
|
||||||
<p>We need to resolve the title levels here.</p>
|
<p>We need to resolve the title levels here.</p>
|
||||||
<!-- Version 1.3 of this ReStructuredText document corresponds to
|
<!-- Version 1.3 of this ReStructuredText document corresponds to
|
||||||
n1530_, the paper accepted by the LWG for TR1. -->
|
n1530_, the paper accepted by the LWG for TR1. -->
|
||||||
@ -448,7 +1079,7 @@ struct enable_if_interoperable
|
|||||||
{};
|
{};
|
||||||
</pre>
|
</pre>
|
||||||
<div class="section" id="iterator-facade-usage">
|
<div class="section" id="iterator-facade-usage">
|
||||||
<h3><a class="toc-backref" href="#id18" name="iterator-facade-usage"><tt class="literal"><span class="pre">iterator_facade</span></tt> usage</a></h3>
|
<h3><a class="toc-backref" href="#id44" name="iterator-facade-usage"><tt class="literal"><span class="pre">iterator_facade</span></tt> usage</a></h3>
|
||||||
<p>The following table describes the typical valid expressions on
|
<p>The following table describes the typical valid expressions on
|
||||||
<tt class="literal"><span class="pre">iterator_facade</span></tt>'s <tt class="literal"><span class="pre">Derived</span></tt> parameter, depending on the
|
<tt class="literal"><span class="pre">iterator_facade</span></tt>'s <tt class="literal"><span class="pre">Derived</span></tt> parameter, depending on the
|
||||||
iterator concept(s) it will model. The operations in the first
|
iterator concept(s) it will model. The operations in the first
|
||||||
@ -460,6 +1091,8 @@ object of type <tt class="literal"><span class="pre">X</span></tt>, <tt class="l
|
|||||||
object of a single pass iterator type interoperable with <tt class="literal"><span class="pre">X</span></tt>, and <tt class="literal"><span class="pre">z</span></tt>
|
object of a single pass iterator type interoperable with <tt class="literal"><span class="pre">X</span></tt>, and <tt class="literal"><span class="pre">z</span></tt>
|
||||||
is a constant object of a random access traversal iterator type
|
is a constant object of a random access traversal iterator type
|
||||||
interoperable with <tt class="literal"><span class="pre">X</span></tt>.</p>
|
interoperable with <tt class="literal"><span class="pre">X</span></tt>.</p>
|
||||||
|
<a class="target" id="id18" name="id18"></a><div class="section" id="iterator-facade-core-operations">
|
||||||
|
<h4><a class="toc-backref" href="#id45" name="iterator-facade-core-operations"><tt class="literal"><span class="pre">iterator_facade</span></tt> Core Operations</a></h4>
|
||||||
<table border class="table">
|
<table border class="table">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="19%" />
|
<col width="19%" />
|
||||||
@ -482,12 +1115,6 @@ Concept(s)</th>
|
|||||||
<td>Readable Iterator, Writable
|
<td>Readable Iterator, Writable
|
||||||
Iterator</td>
|
Iterator</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td><tt class="literal"><span class="pre">c.equal(b)</span></tt></td>
|
|
||||||
<td>convertible to bool</td>
|
|
||||||
<td>true iff <tt class="literal"><span class="pre">b</span></tt> and <tt class="literal"><span class="pre">c</span></tt> are
|
|
||||||
equivalent.</td>
|
|
||||||
<td>Single Pass Iterator</td>
|
|
||||||
</tr>
|
|
||||||
<tr><td><tt class="literal"><span class="pre">c.equal(y)</span></tt></td>
|
<tr><td><tt class="literal"><span class="pre">c.equal(y)</span></tt></td>
|
||||||
<td>convertible to bool</td>
|
<td>convertible to bool</td>
|
||||||
<td>true iff <tt class="literal"><span class="pre">c</span></tt> and <tt class="literal"><span class="pre">y</span></tt> refer to the
|
<td>true iff <tt class="literal"><span class="pre">c</span></tt> and <tt class="literal"><span class="pre">y</span></tt> refer to the
|
||||||
@ -495,12 +1122,6 @@ same position. Implements <tt class="literal"><span class="pre">c</span> <span
|
|||||||
and <tt class="literal"><span class="pre">c</span> <span class="pre">!=</span> <span class="pre">y</span></tt>.</td>
|
and <tt class="literal"><span class="pre">c</span> <span class="pre">!=</span> <span class="pre">y</span></tt>.</td>
|
||||||
<td>Single Pass Iterator</td>
|
<td>Single Pass Iterator</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td><tt class="literal"><span class="pre">a.advance(n)</span></tt></td>
|
|
||||||
<td>unused</td>
|
|
||||||
<td> </td>
|
|
||||||
<td>Random Access Traversal
|
|
||||||
Iterator</td>
|
|
||||||
</tr>
|
|
||||||
<tr><td><tt class="literal"><span class="pre">a.increment()</span></tt></td>
|
<tr><td><tt class="literal"><span class="pre">a.increment()</span></tt></td>
|
||||||
<td>unused</td>
|
<td>unused</td>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
@ -512,6 +1133,12 @@ Iterator</td>
|
|||||||
<td>Bidirectional Traversal
|
<td>Bidirectional Traversal
|
||||||
Iterator</td>
|
Iterator</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr><td><tt class="literal"><span class="pre">a.advance(n)</span></tt></td>
|
||||||
|
<td>unused</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>Random Access Traversal
|
||||||
|
Iterator</td>
|
||||||
|
</tr>
|
||||||
<tr><td><tt class="literal"><span class="pre">c.distance_to(b)</span></tt></td>
|
<tr><td><tt class="literal"><span class="pre">c.distance_to(b)</span></tt></td>
|
||||||
<td>convertible to
|
<td>convertible to
|
||||||
<tt class="literal"><span class="pre">F::difference_type</span></tt></td>
|
<tt class="literal"><span class="pre">F::difference_type</span></tt></td>
|
||||||
@ -531,8 +1158,9 @@ Iterator</td>
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<a class="target" id="facade-iterator-category" name="facade-iterator-category"></a></div>
|
<a class="target" id="facade-iterator-category" name="facade-iterator-category"></a></div>
|
||||||
|
</div>
|
||||||
<div class="section" id="iterator-facade-iterator-category">
|
<div class="section" id="iterator-facade-iterator-category">
|
||||||
<h3><a class="toc-backref" href="#id19" name="iterator-facade-iterator-category"><tt class="literal"><span class="pre">iterator_facade</span></tt> iterator category</a></h3>
|
<h3><a class="toc-backref" href="#id46" name="iterator-facade-iterator-category"><tt class="literal"><span class="pre">iterator_facade</span></tt> iterator category</a></h3>
|
||||||
<p>The <tt class="literal"><span class="pre">iterator_category</span></tt> member of <tt class="literal"><span class="pre">iterator_facade<X,V,R,C,D></span></tt>
|
<p>The <tt class="literal"><span class="pre">iterator_category</span></tt> member of <tt class="literal"><span class="pre">iterator_facade<X,V,R,C,D></span></tt>
|
||||||
is a type which satisfies the following conditions:</p>
|
is a type which satisfies the following conditions:</p>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
@ -585,7 +1213,7 @@ convertible, and not to any more-derived traversal tag type.</p>
|
|||||||
</blockquote>
|
</blockquote>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="iterator-facade-operations">
|
<div class="section" id="iterator-facade-operations">
|
||||||
<h3><a class="toc-backref" href="#id20" name="iterator-facade-operations"><tt class="literal"><span class="pre">iterator_facade</span></tt> operations</a></h3>
|
<h3><a class="toc-backref" href="#id47" name="iterator-facade-operations"><tt class="literal"><span class="pre">iterator_facade</span></tt> operations</a></h3>
|
||||||
<p>The operations in this section are described in terms of operations on
|
<p>The operations in this section are described in terms of operations on
|
||||||
the core interface of <tt class="literal"><span class="pre">Derived</span></tt> which may be inaccessible
|
the core interface of <tt class="literal"><span class="pre">Derived</span></tt> which may be inaccessible
|
||||||
(i.e. private). The implementation should access these operations
|
(i.e. private). The implementation should access these operations
|
||||||
@ -728,5 +1356,11 @@ 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>
|
||||||
|
@ -136,6 +136,11 @@ object of a single pass iterator type interoperable with ``X``, and ``z``
|
|||||||
is a constant object of a random access traversal iterator type
|
is a constant object of a random access traversal iterator type
|
||||||
interoperable with ``X``.
|
interoperable with ``X``.
|
||||||
|
|
||||||
|
.. _`core operations`:
|
||||||
|
|
||||||
|
``iterator_facade`` Core Operations
|
||||||
|
'''''''''''''''''''''''''''''''''''
|
||||||
|
|
||||||
+--------------------+----------------------+-------------------------------------+---------------------------+
|
+--------------------+----------------------+-------------------------------------+---------------------------+
|
||||||
|Expression |Return Type |Assertion/Note |Used to implement Iterator |
|
|Expression |Return Type |Assertion/Note |Used to implement Iterator |
|
||||||
| | | |Concept(s) |
|
| | | |Concept(s) |
|
||||||
@ -143,21 +148,18 @@ interoperable with ``X``.
|
|||||||
|``c.dereference()`` |``F::reference`` | |Readable Iterator, Writable|
|
|``c.dereference()`` |``F::reference`` | |Readable Iterator, Writable|
|
||||||
| | | |Iterator |
|
| | | |Iterator |
|
||||||
+--------------------+----------------------+-------------------------------------+---------------------------+
|
+--------------------+----------------------+-------------------------------------+---------------------------+
|
||||||
|``c.equal(b)`` |convertible to bool |true iff ``b`` and ``c`` are |Single Pass Iterator |
|
|
||||||
| | |equivalent. | |
|
|
||||||
+--------------------+----------------------+-------------------------------------+---------------------------+
|
|
||||||
|``c.equal(y)`` |convertible to bool |true iff ``c`` and ``y`` refer to the|Single Pass Iterator |
|
|``c.equal(y)`` |convertible to bool |true iff ``c`` and ``y`` refer to the|Single Pass Iterator |
|
||||||
| | |same position. Implements ``c == y``| |
|
| | |same position. Implements ``c == y``| |
|
||||||
| | |and ``c != y``. | |
|
| | |and ``c != y``. | |
|
||||||
+--------------------+----------------------+-------------------------------------+---------------------------+
|
+--------------------+----------------------+-------------------------------------+---------------------------+
|
||||||
|``a.advance(n)`` |unused | |Random Access Traversal |
|
|
||||||
| | | |Iterator |
|
|
||||||
+--------------------+----------------------+-------------------------------------+---------------------------+
|
|
||||||
|``a.increment()`` |unused | |Incrementable Iterator |
|
|``a.increment()`` |unused | |Incrementable Iterator |
|
||||||
+--------------------+----------------------+-------------------------------------+---------------------------+
|
+--------------------+----------------------+-------------------------------------+---------------------------+
|
||||||
|``a.decrement()`` |unused | |Bidirectional Traversal |
|
|``a.decrement()`` |unused | |Bidirectional Traversal |
|
||||||
| | | |Iterator |
|
| | | |Iterator |
|
||||||
+--------------------+----------------------+-------------------------------------+---------------------------+
|
+--------------------+----------------------+-------------------------------------+---------------------------+
|
||||||
|
|``a.advance(n)`` |unused | |Random Access Traversal |
|
||||||
|
| | | |Iterator |
|
||||||
|
+--------------------+----------------------+-------------------------------------+---------------------------+
|
||||||
|``c.distance_to(b)``|convertible to |equivalent to ``distance(c, b)`` |Random Access Traversal |
|
|``c.distance_to(b)``|convertible to |equivalent to ``distance(c, b)`` |Random Access Traversal |
|
||||||
| |``F::difference_type``| |Iterator |
|
| |``F::difference_type``| |Iterator |
|
||||||
+--------------------+----------------------+-------------------------------------+---------------------------+
|
+--------------------+----------------------+-------------------------------------+---------------------------+
|
||||||
|
@ -12,7 +12,7 @@ example of a linked list of polymorphic objects.
|
|||||||
The Problem
|
The Problem
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
Say we've written a polymorphic linked list node as follows::
|
Say we've written a polymorphic linked list node base class::
|
||||||
|
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
|
|
||||||
@ -20,15 +20,17 @@ Say we've written a polymorphic linked list node as follows::
|
|||||||
{
|
{
|
||||||
node_base() : m_next(0) {}
|
node_base() : m_next(0) {}
|
||||||
|
|
||||||
|
// Each node manages all of its tail nodes
|
||||||
virtual ~node_base() { delete m_next; }
|
virtual ~node_base() { delete m_next; }
|
||||||
|
|
||||||
|
// Access the rest of the list
|
||||||
node_base* next() const { return m_next; }
|
node_base* next() const { return m_next; }
|
||||||
|
|
||||||
// print to the stream
|
// print to the stream
|
||||||
virtual void print(std::ostream& s) const = 0;
|
virtual void print(std::ostream& s) const = 0;
|
||||||
|
|
||||||
// double the value
|
// double the value
|
||||||
virtual void twice() = 0;
|
virtual void double_me() = 0;
|
||||||
|
|
||||||
void append(node_base* p)
|
void append(node_base* p)
|
||||||
{
|
{
|
||||||
@ -53,7 +55,7 @@ specializations of the following template::
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
void print(std::ostream& s) const { s << this->m_value; }
|
void print(std::ostream& s) const { s << this->m_value; }
|
||||||
void twice() { m_value += m_value; }
|
void double_me() { m_value += m_value; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T m_value;
|
T m_value;
|
||||||
@ -67,7 +69,422 @@ And we can print any node using the following streaming operator::
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Our first challenge is to build an appropriate iterator over these
|
||||||
|
lists.
|
||||||
|
|
||||||
.. sidebar:: Note
|
A Basic Iterator Using ``iterator_facade``
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
Template Parameters
|
||||||
|
...................
|
||||||
|
|
||||||
|
The first step in building a concrete iterator with iterator_facade
|
||||||
|
is to decide what its template parameters will be.
|
||||||
|
|
||||||
|
``Derived``
|
||||||
|
'''''''''''
|
||||||
|
|
||||||
|
Because ``iterator_facade`` is meant to be used with the CRTP
|
||||||
|
[Cop95]_ the first parameter is the iterator class name itself,
|
||||||
|
``node_iterator``.
|
||||||
|
|
||||||
|
``Value``
|
||||||
|
'''''''''
|
||||||
|
|
||||||
|
The ``Value`` parameter determines the ``node_iterator``\ 's
|
||||||
|
``value_type``. In this case, we are iterating over ``node_base``
|
||||||
|
objects, so ``Value`` will be ``node_base``.
|
||||||
|
|
||||||
|
|
||||||
|
``CategoryOrTraversal``
|
||||||
|
'''''''''''''''''''''''
|
||||||
|
|
||||||
|
Now we have to determine which `iterator traversal concept`_ our
|
||||||
|
``node_iterator`` is going to model. Singly-linked lists only have
|
||||||
|
forward links, so our iterator can't can't be a `bidirectional
|
||||||
|
traversal iterator`_. Our iterator should be able to make multiple
|
||||||
|
passes over the same linked list (unlike, say, an
|
||||||
|
``istream_iterator`` which consumes the stream it traverses), so it
|
||||||
|
must be a `forward traversal iterator`_. Therefore, we'll pass
|
||||||
|
``boost::forward_traversal_tag`` in this position [#category]_.
|
||||||
|
|
||||||
|
.. [#category] ``iterator_facade`` also supports old-style category
|
||||||
|
tags, so we could've passed ``std::forward_iterator_tag`` here;
|
||||||
|
either way, the resulting iterator's ``iterator_category`` will
|
||||||
|
end up being ``std::forward_iterator_tag``.
|
||||||
|
|
||||||
|
``Reference``
|
||||||
|
'''''''''''''
|
||||||
|
|
||||||
|
The ``Reference`` argument becomes the type returned by
|
||||||
|
``node_iterator``\ 's dereference operation, and will also be the
|
||||||
|
same as ``std::iterator_traits<node_iterator>::reference``. The
|
||||||
|
library's default for this parameter is ``Value&``; since
|
||||||
|
``node_base&`` is a good choice for the iterator's ``reference``
|
||||||
|
type, we can omit this argument, or pass ``use_default``.
|
||||||
|
|
||||||
|
``Difference``
|
||||||
|
''''''''''''''
|
||||||
|
|
||||||
|
The ``Difference`` argument determines how the distance between
|
||||||
|
two ``node_iterator``\ s will be measured and will also be the
|
||||||
|
same as ``std::iterator_traits<node_iterator>::difference_type``.
|
||||||
|
The library's default for ``Difference`` is ``std::ptrdiff_t``, an
|
||||||
|
appropriate type for measuring the distance between any two
|
||||||
|
addresses in memory, and one that works for almost any iterator,
|
||||||
|
so we can omit this argument, too.
|
||||||
|
|
||||||
|
The declaration of ``node_iterator`` will therefore look something
|
||||||
|
like::
|
||||||
|
|
||||||
|
# include "node.hpp"
|
||||||
|
# include <boost/iterator/iterator_facade.hpp>
|
||||||
|
|
||||||
|
class node_iterator
|
||||||
|
: public boost::iterator_facade<
|
||||||
|
node_iterator
|
||||||
|
, node_base
|
||||||
|
, boost::forward_traversal_tag
|
||||||
|
>
|
||||||
|
{
|
||||||
|
...
|
||||||
|
};
|
||||||
|
|
||||||
|
Constructors and Data Members
|
||||||
|
.............................
|
||||||
|
|
||||||
|
Next we need to decide how to represent the iterator's position.
|
||||||
|
This representation will take the form of data members, so we'll
|
||||||
|
also need to write constructors to initialize them. The
|
||||||
|
``node_iterator``\ 's position is quite naturally represented using
|
||||||
|
a pointer to a ``node_base``. We'll need a constructor to build an
|
||||||
|
iterator from a ``node_base*``, and a default constructor to
|
||||||
|
satisfy the `forward traversal iterator`_ requirements [#default]_.
|
||||||
|
Our ``node_iterator`` then becomes::
|
||||||
|
|
||||||
|
# include "node.hpp"
|
||||||
|
# include <boost/iterator/iterator_facade.hpp>
|
||||||
|
|
||||||
|
class node_iterator
|
||||||
|
: public boost::iterator_facade<
|
||||||
|
node_iterator
|
||||||
|
, node_base
|
||||||
|
, boost::forward_traversal_tag
|
||||||
|
>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
node_iterator()
|
||||||
|
: m_node(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
explicit node_iterator(node_base* p)
|
||||||
|
: m_node(p)
|
||||||
|
{}
|
||||||
|
|
||||||
|
private:
|
||||||
|
...
|
||||||
|
node_base* m_node;
|
||||||
|
};
|
||||||
|
|
||||||
|
.. [#default] Technically, the C++ standard places almost no
|
||||||
|
requirements on a default-constructed iterator, so if we were
|
||||||
|
really concerned with efficiency, we could've written the
|
||||||
|
default constructor to leave ``m_node`` uninitialized.
|
||||||
|
|
||||||
|
Core Operations
|
||||||
|
...............
|
||||||
|
|
||||||
|
The last step is to implement the `core operations`_ required by
|
||||||
|
the concepts we want our iterator to model. Referring to the
|
||||||
|
table__, we can see that the first three rows are applicable
|
||||||
|
because ``node_iterator`` needs to satisfy the requirements for
|
||||||
|
`readable iterator`_, `single pass iterator`_, and `incrementable
|
||||||
|
iterator`_.
|
||||||
|
|
||||||
|
__ `core operations`_
|
||||||
|
|
||||||
|
We therefore need to supply ``dereference``,
|
||||||
|
``equal``, and ``increment`` members. We don't want these members
|
||||||
|
to become part of ``node_iterator``\ 's public interface, so we can
|
||||||
|
make them private and grant friendship to
|
||||||
|
``boost::iterator_core_access``, a "back-door" that
|
||||||
|
``iterator_facade`` uses to get access to the core operations::
|
||||||
|
|
||||||
|
# include "node.hpp"
|
||||||
|
# include <boost/iterator/iterator_facade.hpp>
|
||||||
|
|
||||||
|
class node_iterator
|
||||||
|
: public boost::iterator_facade<
|
||||||
|
node_iterator
|
||||||
|
, node_base
|
||||||
|
, boost::forward_traversal_tag
|
||||||
|
>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
node_iterator()
|
||||||
|
: m_node(0) {}
|
||||||
|
|
||||||
|
explicit node_iterator(node_base* p)
|
||||||
|
: m_node(p) {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class boost::iterator_core_access;
|
||||||
|
|
||||||
|
void increment() { m_node = m_node->next(); }
|
||||||
|
|
||||||
|
bool equal(node_iterator const& other) const
|
||||||
|
{
|
||||||
|
return this->m_node == other.m_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
node_base& dereference() const { return *m_node; }
|
||||||
|
|
||||||
|
node_base* m_node;
|
||||||
|
};
|
||||||
|
|
||||||
|
Voilà; a complete and conforming readable, forward-traversal
|
||||||
|
iterator! For a working example of its use, see `this program`__.
|
||||||
|
|
||||||
|
__ ../example/node_iterator1.cpp
|
||||||
|
|
||||||
|
A constant ``node_iterator``
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
.. Sidebar:: Constant and Mutable iterators
|
||||||
|
|
||||||
|
The term **mutable iterator** means an iterator through which
|
||||||
|
the object it references (its "referent") can be modified. A
|
||||||
|
**constant iterator** is one which doesn't allow modification of
|
||||||
|
its referent.
|
||||||
|
|
||||||
|
The words *constant* and *mutable* don't refer to the ability to
|
||||||
|
modify the iterator itself. For example, an ``int const*`` is a
|
||||||
|
non-\ ``const`` *constant iterator*, which can be incremented
|
||||||
|
but doesn't allow modification of its referent, and ``int*
|
||||||
|
const`` is a ``const`` *mutable iterator*, which cannot be
|
||||||
|
modified but which allows modification of its referent.
|
||||||
|
|
||||||
|
Confusing? We agree, but those are the standard terms. It
|
||||||
|
probably doesn't help much that a container's constant iterator
|
||||||
|
is called ``const_iterator``.
|
||||||
|
|
||||||
|
Now, our ``node_iterator`` gives clients access to both ``node``\
|
||||||
|
's ``print(std::ostream&) const`` member function, but also its
|
||||||
|
mutating ``double_me()`` member. If we wanted to build a
|
||||||
|
*constant* ``node_iterator``, we'd only have to make three
|
||||||
|
changes:
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
class const_node_iterator
|
||||||
|
: public boost::iterator_facade<
|
||||||
|
node_iterator
|
||||||
|
, node_base **const**
|
||||||
|
, boost::forward_traversal_tag
|
||||||
|
>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
const_node_iterator()
|
||||||
|
: m_node(0) {}
|
||||||
|
|
||||||
|
explicit const_node_iterator(node_base* p)
|
||||||
|
: m_node(p) {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class boost::iterator_core_access;
|
||||||
|
|
||||||
|
void increment() { m_node = m_node->next(); }
|
||||||
|
|
||||||
|
bool equal(const_node_iterator const& other) const
|
||||||
|
{
|
||||||
|
return this->m_node == other.m_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
node_base **const**\ & dereference() const { return \*m_node; }
|
||||||
|
|
||||||
|
node_base **const**\ * m_node;
|
||||||
|
};
|
||||||
|
|
||||||
|
.. Sidebar:: ``const`` and an iterator's ``value_type``
|
||||||
|
|
||||||
|
The C++ standard requires an iterator's ``value_type`` *not* be
|
||||||
|
``const``\ -qualified, so ``iterator_facade`` strips the
|
||||||
|
``const`` from its ``Value`` parameter in order to produce the
|
||||||
|
iterator's ``value_type``. Making the ``Value`` argument
|
||||||
|
``const`` provides a useful hint to ``iterator_facade`` that the
|
||||||
|
iterator is a *constant iterator*, and the default ``Reference``
|
||||||
|
argument will be correct for all lvalue iterators.
|
||||||
|
|
||||||
|
As a matter of fact, ``node_iterator`` and ``const_node_iterator``
|
||||||
|
are so similar that it makes sense to factor the common code out
|
||||||
|
into a template as follows::
|
||||||
|
|
||||||
|
template <class Value>
|
||||||
|
class node_iter
|
||||||
|
: public boost::iterator_facade<
|
||||||
|
node_iter<Value>
|
||||||
|
, Value
|
||||||
|
, boost::forward_traversal_tag
|
||||||
|
>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
node_iter()
|
||||||
|
: m_node(0) {}
|
||||||
|
|
||||||
|
explicit node_iter(Value* p)
|
||||||
|
: m_node(p) {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class boost::iterator_core_access;
|
||||||
|
|
||||||
|
bool equal(node_iter<Value> const& other) const
|
||||||
|
{
|
||||||
|
return this->m_node == other.m_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
void increment()
|
||||||
|
{ m_node = m_node->next(); }
|
||||||
|
|
||||||
|
Value& dereference() const
|
||||||
|
{ return *m_node; }
|
||||||
|
|
||||||
|
Value* m_node;
|
||||||
|
};
|
||||||
|
typedef node_iter<node_base> node_iterator;
|
||||||
|
typedef node_iter<node_base const> node_const_iterator;
|
||||||
|
|
||||||
|
|
||||||
|
Interoperability
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Our ``const_node_iterator`` works perfectly well on its own, but
|
||||||
|
taken together with ``node_iterator`` it doesn't quite meet
|
||||||
|
expectations. For example, we'd like to be able to pass a
|
||||||
|
``node_iterator`` where a ``node_const_iterator`` was expected,
|
||||||
|
just as you can with ``std::list<int>``\ 's ``iterator`` and
|
||||||
|
``const_iterator``. Furthermore, given a ``node_iterator`` and a
|
||||||
|
``node_const_iterator`` into the same list, we should be able to
|
||||||
|
compare them for equality.
|
||||||
|
|
||||||
|
This expected ability to use two different iterator types together
|
||||||
|
is known as **interoperability**. Achieving interoperability in
|
||||||
|
our case is as simple as templatizing the ``equal`` function and
|
||||||
|
adding a templatized converting constructor [#broken]_ [#random]_::
|
||||||
|
|
||||||
|
template <class Value>
|
||||||
|
class node_iter
|
||||||
|
: public boost::iterator_facade<
|
||||||
|
node_iter<Value>
|
||||||
|
, Value
|
||||||
|
, boost::forward_traversal_tag
|
||||||
|
>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
node_iter()
|
||||||
|
: m_node(0) {}
|
||||||
|
|
||||||
|
explicit node_iter(Value* p)
|
||||||
|
: m_node(p) {}
|
||||||
|
|
||||||
|
template <class OtherValue>
|
||||||
|
node_iter(node_iter<OtherValue> const& other)
|
||||||
|
: m_node(other.m_node) {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class boost::iterator_core_access;
|
||||||
|
template <class> friend class node_iter;
|
||||||
|
|
||||||
|
template <class OtherValue>
|
||||||
|
bool equal(node_iter<OtherValue> const& other) const
|
||||||
|
{
|
||||||
|
return this->m_node == other.m_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
void increment()
|
||||||
|
{ m_node = m_node->next(); }
|
||||||
|
|
||||||
|
Value& dereference() const
|
||||||
|
{ return *m_node; }
|
||||||
|
|
||||||
|
Value* m_node;
|
||||||
|
};
|
||||||
|
typedef impl::node_iterator<node_base> node_iterator;
|
||||||
|
typedef impl::node_iterator<node_base const> node_const_iterator;
|
||||||
|
|
||||||
|
.. [#broken] If you're using an older compiler and it can't handle
|
||||||
|
this example, see the `example code`__ for workarounds.
|
||||||
|
|
||||||
|
.. [#random] If ``node_iterator`` had been a `random access
|
||||||
|
traversal iterator`_, we'd have had to templatize its
|
||||||
|
``distance_to`` function as well.
|
||||||
|
|
||||||
|
|
||||||
|
__ ../example/node_iterator2.hpp
|
||||||
|
|
||||||
|
You can see an example program which exercises our interoperable
|
||||||
|
iterators `here`__.
|
||||||
|
|
||||||
|
__ ../example/node_iterator2.cpp
|
||||||
|
|
||||||
|
Telling the Truth
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
Now ``node_iterator`` and ``node_const_iterator`` behave exactly as
|
||||||
|
you'd expect... almost. We can compare them and we can convert in
|
||||||
|
one direction: from ``node_iterator`` to ``node_const_iterator``.
|
||||||
|
If we try to convert from ``node_const_iterator`` to
|
||||||
|
``node_iterator``, we'll get an error when the converting
|
||||||
|
constructor tries to initialize ``node_iterator``\ 's ``m_node``, a
|
||||||
|
``node*`` with a ``node const*``. So what's the problem?
|
||||||
|
|
||||||
|
The problem is that
|
||||||
|
``boost::``\ |is_convertible|_\ ``<node_const_iterator,node_iterator>::value``
|
||||||
|
will be ``true``, but it should be ``false``. |is_convertible|_
|
||||||
|
lies because it can only see as far as the *declaration* of
|
||||||
|
``node_iter``\ 's converting constructor, but can't look inside at
|
||||||
|
the *definition* to make sure it will compile. A perfect solution
|
||||||
|
would make ``node_iter``\ 's converting constructor disappear when
|
||||||
|
the ``m_node`` conversion would fail.
|
||||||
|
|
||||||
|
.. |is_convertible| replace:: ``is_convertible``
|
||||||
|
.. _is_convertible: ../../type_traits/index.html#relationships
|
||||||
|
|
||||||
|
In fact, that sort of magic is possible using
|
||||||
|
|enable_if|__. By rewriting the converting constructor as
|
||||||
|
follows, we can remove it from the overload set when it's not
|
||||||
|
appropriate::
|
||||||
|
|
||||||
|
template <class OtherValue>
|
||||||
|
node_iter(
|
||||||
|
node_iter<OtherValue> const& other
|
||||||
|
, typename boost::enable_if<
|
||||||
|
boost::is_convertible<OtherValue*,Value*>
|
||||||
|
, enabler
|
||||||
|
>::type = enabler()
|
||||||
|
)
|
||||||
|
: m_node(other.m_node) {}
|
||||||
|
|
||||||
|
.. |enable_if| replace:: ``boost::enable_if``
|
||||||
|
__ ../../utility/enable_if.html
|
||||||
|
|
||||||
|
|
||||||
|
Wrap Up
|
||||||
|
-------
|
||||||
|
|
||||||
|
This concludes our ``iterator_facade`` tutorial, but before you
|
||||||
|
stop reading we urge you to take a look at |iterator_adaptor|__.
|
||||||
|
There's another way to approach writing these iterators which might
|
||||||
|
even be superior.
|
||||||
|
|
||||||
|
.. |iterator_adaptor| replace:: ``iterator_adaptor``
|
||||||
|
__ iterator_adaptor.html
|
||||||
|
|
||||||
|
.. _`iterator traversal concept`: new-iter-concepts.html#iterator-traversal-concepts-lib-iterator-traversal
|
||||||
|
.. _`readable iterator`: new-iter-concepts.html#readable-iterators-lib-readable-iterators
|
||||||
|
.. _`lvalue iterator`: new-iter-concepts.html#lvalue-iterators-lib-lvalue-iterators
|
||||||
|
.. _`single pass iterator`: new-iter-concepts.html#single-pass-iterators-lib-single-pass-iterators
|
||||||
|
.. _`incrementable iterator`: new-iter-concepts.html#incrementable-iterators-lib-incrementable-iterators
|
||||||
|
.. _`forward traversal iterator`: new-iter-concepts.html#forward-traversal-iterators-lib-forward-traversal-iterators
|
||||||
|
.. _`bidirectional traversal iterator`: new-iter-concepts.html#bidirectional-traversal-iterators-lib-bidirectional-traversal-iterators
|
||||||
|
.. _`random access traversal iterator`: new-iter-concepts.html#random-access-traversal-iterators-lib-random-access-traversal-iterators
|
||||||
|
|
||||||
This is in progress; check the ../example directory for code.
|
|
@ -3,13 +3,240 @@
|
|||||||
<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.0: http://docutils.sourceforge.net/" />
|
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
||||||
<title>New Iterator Concepts</title>
|
<title>New Iterator Concepts</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-12-02" />
|
<meta name="date" content="2003-12-02" />
|
||||||
<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" />
|
<style 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="new-iterator-concepts">
|
<div class="document" id="new-iterator-concepts">
|
||||||
@ -881,5 +1108,11 @@ LocalWords: incrementable xxx min prev inplace png oldeqnew AccessTag struct
|
|||||||
LocalWords: TraversalTag typename lvalues DWA Hmm JGS mis enum -->
|
LocalWords: TraversalTag typename lvalues DWA Hmm JGS mis enum -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<hr class="footer" />
|
||||||
|
<div class="footer">
|
||||||
|
<a class="reference" href="new-iter-concepts.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>
|
||||||
|
@ -3,13 +3,240 @@
|
|||||||
<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.0: http://docutils.sourceforge.net/" />
|
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
||||||
<title>Permutation Iterator</title>
|
<title>Permutation Iterator</title>
|
||||||
<meta name="author" content="Toon Knapen, David Abrahams, Roland Richter, Jeremy Siek" />
|
<meta name="author" content="Toon Knapen, David Abrahams, Roland Richter, Jeremy Siek" />
|
||||||
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab" />
|
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab" />
|
||||||
<meta name="date" content="2003-09-14" />
|
<meta name="date" content="2003-09-14" />
|
||||||
<meta name="copyright" content="Copyright Toon Knapen, David Abrahams, Roland Richter, and Jeremy Siek 2003. All rights reserved" />
|
<meta name="copyright" content="Copyright Toon Knapen, David Abrahams, Roland Richter, and Jeremy Siek 2003. All rights reserved" />
|
||||||
<link rel="stylesheet" href="default.css" type="text/css" />
|
<style 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="permutation-iterator">
|
<div class="document" id="permutation-iterator">
|
||||||
@ -119,5 +346,11 @@ ForwardIterator instead of amortized constant time.</p>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<hr class="footer" />
|
||||||
|
<div class="footer">
|
||||||
|
<a class="reference" href="permutation_iterator.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>
|
||||||
|
@ -3,13 +3,240 @@
|
|||||||
<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.0: http://docutils.sourceforge.net/" />
|
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
||||||
<title>Reverse Iterator</title>
|
<title>Reverse 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="2004-01-11" />
|
<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" />
|
<style 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="reverse-iterator">
|
<div class="document" id="reverse-iterator">
|
||||||
@ -27,7 +254,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>2004-01-11</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>
|
||||||
@ -202,5 +429,11 @@ sequence in double-reversed (normal) order: hello world!
|
|||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<hr class="footer" />
|
||||||
|
<div class="footer">
|
||||||
|
<a class="reference" href="reverse_iterator.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>
|
||||||
|
@ -2,6 +2,9 @@ subproject libs/iterator/example ;
|
|||||||
|
|
||||||
import testing ;
|
import testing ;
|
||||||
|
|
||||||
|
# Make tests run by default.
|
||||||
|
DEPENDS all : test ;
|
||||||
|
|
||||||
test-suite iterator_examples
|
test-suite iterator_examples
|
||||||
: [ run reverse_iterator.cpp ]
|
: [ run reverse_iterator.cpp ]
|
||||||
[ run node_iterator1.cpp ]
|
[ run node_iterator1.cpp ]
|
||||||
|
@ -23,7 +23,7 @@ struct node_base
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void print(std::ostream& s) const = 0;
|
virtual void print(std::ostream& s) const = 0;
|
||||||
virtual void twice() = 0;
|
virtual void double_me() = 0;
|
||||||
|
|
||||||
void append(node_base* p)
|
void append(node_base* p)
|
||||||
{
|
{
|
||||||
@ -51,7 +51,7 @@ struct node : node_base
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
void print(std::ostream& s) const { s << this->m_value; }
|
void print(std::ostream& s) const { s << this->m_value; }
|
||||||
void twice() { m_value += m_value; }
|
void double_me() { m_value += m_value; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T m_value;
|
T m_value;
|
||||||
|
@ -23,7 +23,7 @@ int main()
|
|||||||
|
|
||||||
std::for_each(
|
std::for_each(
|
||||||
node_iterator(nodes.get()), node_iterator()
|
node_iterator(nodes.get()), node_iterator()
|
||||||
, std::mem_fun_ref(&node_base::twice)
|
, std::mem_fun_ref(&node_base::double_me)
|
||||||
);
|
);
|
||||||
|
|
||||||
std::copy(
|
std::copy(
|
||||||
|
@ -23,9 +23,9 @@ class node_iterator
|
|||||||
: m_node(p)
|
: m_node(p)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
private:
|
||||||
friend class boost::iterator_core_access;
|
friend class boost::iterator_core_access;
|
||||||
|
|
||||||
private:
|
|
||||||
void increment()
|
void increment()
|
||||||
{ m_node = m_node->next(); }
|
{ m_node = m_node->next(); }
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ int main()
|
|||||||
|
|
||||||
std::for_each(
|
std::for_each(
|
||||||
node_iterator(nodes.get()), node_iterator()
|
node_iterator(nodes.get()), node_iterator()
|
||||||
, boost::mem_fn(&node_base::twice)
|
, boost::mem_fn(&node_base::double_me)
|
||||||
);
|
);
|
||||||
|
|
||||||
std::copy(
|
std::copy(
|
||||||
|
@ -12,65 +12,62 @@
|
|||||||
# include <boost/utility/enable_if.hpp>
|
# include <boost/utility/enable_if.hpp>
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
namespace impl
|
|
||||||
{
|
|
||||||
template <class Value>
|
template <class Value>
|
||||||
class node_iterator
|
class node_iter
|
||||||
: public boost::iterator_facade<
|
: public boost::iterator_facade<
|
||||||
node_iterator<Value>
|
node_iter<Value>
|
||||||
, Value
|
, Value
|
||||||
, boost::forward_traversal_tag
|
, boost::forward_traversal_tag
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
enum enabler {};
|
struct enabler {}; // a private type avoids misuse
|
||||||
|
|
||||||
public:
|
public:
|
||||||
node_iterator()
|
node_iter()
|
||||||
: m_node(0)
|
: m_node(0) {}
|
||||||
{}
|
|
||||||
|
|
||||||
explicit node_iterator(Value* p)
|
explicit node_iter(Value* p)
|
||||||
: m_node(p)
|
: m_node(p) {}
|
||||||
{}
|
|
||||||
|
|
||||||
template <class OtherValue>
|
template <class OtherValue>
|
||||||
node_iterator(
|
node_iter(
|
||||||
node_iterator<OtherValue> const& other
|
node_iter<OtherValue> const& other
|
||||||
# ifndef BOOST_NO_SFINAE
|
# ifndef BOOST_NO_SFINAE
|
||||||
, typename boost::enable_if<boost::is_convertible<OtherValue*,Value*>,enabler*>::type = 0
|
, typename boost::enable_if<
|
||||||
|
boost::is_convertible<OtherValue*,Value*>
|
||||||
|
, enabler
|
||||||
|
>::type = enabler()
|
||||||
# endif
|
# endif
|
||||||
)
|
)
|
||||||
: m_node(other.m_node)
|
: m_node(other.m_node) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
friend class boost::iterator_core_access;
|
|
||||||
# if !BOOST_WORKAROUND(__GNUC__, == 2)
|
# if !BOOST_WORKAROUND(__GNUC__, == 2)
|
||||||
private: // GCC2 can't even grant that friendship to template member functions
|
private: // GCC2 can't even grant that friendship to template member functions
|
||||||
# endif
|
# endif
|
||||||
|
friend class boost::iterator_core_access;
|
||||||
|
|
||||||
template <class OtherValue>
|
template <class OtherValue>
|
||||||
bool equal(node_iterator<OtherValue> const& other) const
|
bool equal(node_iter<OtherValue> const& other) const
|
||||||
{ return this->m_node == other.m_node; }
|
{
|
||||||
|
return this->m_node == other.m_node;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
private:
|
||||||
void increment()
|
void increment() { m_node = m_node->next(); }
|
||||||
{ m_node = m_node->next(); }
|
|
||||||
|
|
||||||
Value& dereference() const
|
Value& dereference() const { return *m_node; }
|
||||||
{ return *m_node; }
|
|
||||||
|
|
||||||
# ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
# ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||||
public:
|
public:
|
||||||
# else
|
# else
|
||||||
template <class> friend class node_iterator;
|
template <class> friend class node_iter;
|
||||||
# endif
|
# endif
|
||||||
Value* m_node;
|
Value* m_node;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
typedef impl::node_iterator<node_base> node_iterator;
|
typedef node_iter<node_base> node_iterator;
|
||||||
typedef impl::node_iterator<node_base const> node_const_iterator;
|
typedef node_iter<node_base const> node_const_iterator;
|
||||||
|
|
||||||
#endif // NODE_ITERATOR2_DWA2004110_HPP
|
#endif // NODE_ITERATOR2_DWA2004110_HPP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user