mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-09 23:23:54 +00:00
added base() function to the interface of the specialized adaptors
[SVN r21619]
This commit is contained in:
parent
5b608e114b
commit
f0add8a043
@ -3,240 +3,13 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils 0.3.0: http://docutils.sourceforge.net/" />
|
||||
<title>Counting Iterator</title>
|
||||
<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="date" content="2004-01-12" />
|
||||
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
||||
<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>
|
||||
<link rel="stylesheet" href="default.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="counting-iterator">
|
||||
@ -435,11 +208,5 @@ indirectly printing out the numbers from 0 to 7
|
||||
</pre>
|
||||
</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>
|
||||
</html>
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
Example
|
||||
-------
|
||||
.......
|
||||
|
||||
This example fills an array with numbers and a second array with
|
||||
pointers into the first array, using ``counting_iterator`` for both
|
||||
|
@ -22,7 +22,7 @@
|
||||
the cases when the ``Incrementable`` type is a numeric type.]
|
||||
|
||||
``counting_iterator`` requirements
|
||||
----------------------------------
|
||||
..................................
|
||||
|
||||
The ``Incrementable`` type must be Default Constructible, Copy
|
||||
Constructible, and Assignable. The default distance is
|
||||
@ -30,7 +30,7 @@ an implementation defined signed integral type.
|
||||
|
||||
|
||||
``counting_iterator`` models
|
||||
----------------------------
|
||||
............................
|
||||
|
||||
``counting_iterator`` models Readable Lvalue Iterator.
|
||||
|
||||
@ -59,7 +59,7 @@ required::
|
||||
|
||||
|
||||
``counting_iterator`` operations
|
||||
--------------------------------
|
||||
................................
|
||||
|
||||
``counting_iterator();``
|
||||
|
||||
|
@ -3,239 +3,12 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils 0.3.0: http://docutils.sourceforge.net/" />
|
||||
<title>Iterator Facade and Adaptor</title>
|
||||
<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="date" content="2003-11-24" />
|
||||
<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>
|
||||
<link rel="stylesheet" href="default.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="iterator-facade-and-adaptor">
|
||||
@ -332,36 +105,34 @@ by adapting other iterators.</td>
|
||||
</li>
|
||||
<li><a class="reference" href="#reverse-iterator" id="id46" name="id46">Reverse iterator</a><ul>
|
||||
<li><a class="reference" href="#class-template-reverse-iterator" id="id47" name="id47">Class template <tt class="literal"><span class="pre">reverse_iterator</span></tt></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#reverse-iterator-requirements" id="id48" name="id48"><tt class="literal"><span class="pre">reverse_iterator</span></tt> requirements</a></li>
|
||||
<li><a class="reference" href="#reverse-iterator-models" id="id49" name="id49"><tt class="literal"><span class="pre">reverse_iterator</span></tt> models</a></li>
|
||||
<li><a class="reference" href="#reverse-iterator-operations" id="id50" name="id50"><tt class="literal"><span class="pre">reverse_iterator</span></tt> operations</a></li>
|
||||
<li><a class="reference" href="#transform-iterator" id="id51" name="id51">Transform iterator</a><ul>
|
||||
<li><a class="reference" href="#class-template-transform-iterator" id="id52" name="id52">Class template <tt class="literal"><span class="pre">transform_iterator</span></tt></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#transform-iterator" id="id51" name="id51">Transform iterator</a><ul>
|
||||
<li><a class="reference" href="#class-template-transform-iterator" id="id52" name="id52">Class template <tt class="literal"><span class="pre">transform_iterator</span></tt></a></li>
|
||||
<li><a class="reference" href="#transform-iterator-requirements" id="id53" name="id53"><tt class="literal"><span class="pre">transform_iterator</span></tt> requirements</a></li>
|
||||
<li><a class="reference" href="#transform-iterator-models" id="id54" name="id54"><tt class="literal"><span class="pre">transform_iterator</span></tt> models</a></li>
|
||||
<li><a class="reference" href="#transform-iterator-operations" id="id55" name="id55"><tt class="literal"><span class="pre">transform_iterator</span></tt> operations</a></li>
|
||||
<li><a class="reference" href="#filter-iterator" id="id56" name="id56">Filter iterator</a><ul>
|
||||
<li><a class="reference" href="#class-template-filter-iterator" id="id57" name="id57">Class template <tt class="literal"><span class="pre">filter_iterator</span></tt></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#filter-iterator" id="id56" name="id56">Filter iterator</a><ul>
|
||||
<li><a class="reference" href="#class-template-filter-iterator" id="id57" name="id57">Class template <tt class="literal"><span class="pre">filter_iterator</span></tt></a></li>
|
||||
<li><a class="reference" href="#filter-iterator-requirements" id="id58" name="id58"><tt class="literal"><span class="pre">filter_iterator</span></tt> requirements</a></li>
|
||||
<li><a class="reference" href="#filter-iterator-models" id="id59" name="id59"><tt class="literal"><span class="pre">filter_iterator</span></tt> models</a></li>
|
||||
<li><a class="reference" href="#filter-iterator-operations" id="id60" name="id60"><tt class="literal"><span class="pre">filter_iterator</span></tt> operations</a></li>
|
||||
<li><a class="reference" href="#counting-iterator" id="id61" name="id61">Counting iterator</a><ul>
|
||||
<li><a class="reference" href="#class-template-counting-iterator" id="id62" name="id62">Class template <tt class="literal"><span class="pre">counting_iterator</span></tt></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#counting-iterator" id="id61" name="id61">Counting iterator</a><ul>
|
||||
<li><a class="reference" href="#class-template-counting-iterator" id="id62" name="id62">Class template <tt class="literal"><span class="pre">counting_iterator</span></tt></a></li>
|
||||
<li><a class="reference" href="#counting-iterator-requirements" id="id63" name="id63"><tt class="literal"><span class="pre">counting_iterator</span></tt> requirements</a></li>
|
||||
<li><a class="reference" href="#counting-iterator-models" id="id64" name="id64"><tt class="literal"><span class="pre">counting_iterator</span></tt> models</a></li>
|
||||
<li><a class="reference" href="#counting-iterator-operations" id="id65" name="id65"><tt class="literal"><span class="pre">counting_iterator</span></tt> operations</a></li>
|
||||
<li><a class="reference" href="#function-output-iterator" id="id66" name="id66">Function output iterator</a><ul>
|
||||
<li><a class="reference" href="#class-template-function-output-iterator" id="id67" name="id67">Class template <tt class="literal"><span class="pre">function_output_iterator</span></tt></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#function-output-iterator" id="id66" name="id66">Function output iterator</a><ul>
|
||||
<li><a class="reference" href="#class-template-function-output-iterator" id="id67" name="id67">Class template <tt class="literal"><span class="pre">function_output_iterator</span></tt></a></li>
|
||||
<li><a class="reference" href="#function-output-iterator-requirements" id="id68" name="id68"><tt class="literal"><span class="pre">function_output_iterator</span></tt> requirements</a></li>
|
||||
<li><a class="reference" href="#function-output-iterator-operations" id="id69" name="id69"><tt class="literal"><span class="pre">function_output_iterator</span></tt> operations</a></li>
|
||||
<li><a class="reference" href="#function-output-iterator-output-proxy-operations" id="id70" name="id70"><tt class="literal"><span class="pre">function_output_iterator::output_proxy</span></tt> operations</a></li>
|
||||
@ -370,6 +141,8 @@ by adapting other iterators.</td>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="motivation">
|
||||
<h1><a class="toc-backref" href="#id13" name="motivation">Motivation</a></h1>
|
||||
@ -1655,21 +1428,20 @@ private:
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="reverse-iterator-requirements">
|
||||
<h3><a class="toc-backref" href="#id48" name="reverse-iterator-requirements"><tt class="literal"><span class="pre">reverse_iterator</span></tt> requirements</a></h3>
|
||||
<h4><a class="toc-backref" href="#id48" name="reverse-iterator-requirements"><tt class="literal"><span class="pre">reverse_iterator</span></tt> requirements</a></h4>
|
||||
<p>The base <tt class="literal"><span class="pre">Iterator</span></tt> must be a model of Bidirectional Traversal
|
||||
Iterator and Readable Iterator.</p>
|
||||
</div>
|
||||
<div class="section" id="reverse-iterator-models">
|
||||
<h3><a class="toc-backref" href="#id49" name="reverse-iterator-models"><tt class="literal"><span class="pre">reverse_iterator</span></tt> models</a></h3>
|
||||
<h4><a class="toc-backref" href="#id49" name="reverse-iterator-models"><tt class="literal"><span class="pre">reverse_iterator</span></tt> models</a></h4>
|
||||
<p><tt class="literal"><span class="pre">reverse_iterator</span></tt> models Bidirectional Traversal Iterator and
|
||||
Readable Iterator. In addition, <tt class="literal"><span class="pre">reverse_iterator</span></tt> models the same
|
||||
standard iterator access concepts that the <tt class="literal"><span class="pre">Iterator</span></tt>
|
||||
argument models.</p>
|
||||
</div>
|
||||
<div class="section" id="reverse-iterator-operations">
|
||||
<h3><a class="toc-backref" href="#id50" name="reverse-iterator-operations"><tt class="literal"><span class="pre">reverse_iterator</span></tt> operations</a></h3>
|
||||
<h4><a class="toc-backref" href="#id50" name="reverse-iterator-operations"><tt class="literal"><span class="pre">reverse_iterator</span></tt> operations</a></h4>
|
||||
<p><tt class="literal"><span class="pre">reverse_iterator();</span></tt></p>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@ -1720,7 +1492,7 @@ reverse_iterator(
|
||||
</table>
|
||||
<pre class="literal-block">
|
||||
Iterator tmp = current;
|
||||
return *--tmp;
|
||||
return *..tmp;
|
||||
</pre>
|
||||
<p><tt class="literal"><span class="pre">reverse_iterator&</span> <span class="pre">operator++();</span></tt></p>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
@ -1734,6 +1506,7 @@ return *--tmp;
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="transform-iterator">
|
||||
<h3><a class="toc-backref" href="#id51" name="transform-iterator">Transform iterator</a></h3>
|
||||
<p>The transform iterator adapts an iterator by applying some function
|
||||
@ -1772,9 +1545,8 @@ private:
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="transform-iterator-requirements">
|
||||
<h3><a class="toc-backref" href="#id53" name="transform-iterator-requirements"><tt class="literal"><span class="pre">transform_iterator</span></tt> requirements</a></h3>
|
||||
<h4><a class="toc-backref" href="#id53" name="transform-iterator-requirements"><tt class="literal"><span class="pre">transform_iterator</span></tt> requirements</a></h4>
|
||||
<p>The type <tt class="literal"><span class="pre">UnaryFunction</span></tt> must be Assignable, Copy Constructible, and
|
||||
the expression <tt class="literal"><span class="pre">f(*i)</span></tt> must be valid where <tt class="literal"><span class="pre">f</span></tt> is an object of
|
||||
type <tt class="literal"><span class="pre">UnaryFunction</span></tt>, <tt class="literal"><span class="pre">i</span></tt> is an object of type <tt class="literal"><span class="pre">Iterator</span></tt>, and
|
||||
@ -1783,7 +1555,7 @@ where the type of <tt class="literal"><span class="pre">f(*i)</span></tt> must b
|
||||
<p>The type <tt class="literal"><span class="pre">Iterator</span></tt> must at least model Readable Iterator.</p>
|
||||
</div>
|
||||
<div class="section" id="transform-iterator-models">
|
||||
<h3><a class="toc-backref" href="#id54" name="transform-iterator-models"><tt class="literal"><span class="pre">transform_iterator</span></tt> models</a></h3>
|
||||
<h4><a class="toc-backref" href="#id54" name="transform-iterator-models"><tt class="literal"><span class="pre">transform_iterator</span></tt> models</a></h4>
|
||||
<p>The resulting <tt class="literal"><span class="pre">transform_iterator</span></tt> models the most refined of the
|
||||
following options that is also modeled by <tt class="literal"><span class="pre">Iterator</span></tt>.</p>
|
||||
<blockquote>
|
||||
@ -1801,7 +1573,7 @@ concept that is modeled by <tt class="literal"><span class="pre">Iterator</span>
|
||||
The <tt class="literal"><span class="pre">value_type</span></tt> is <tt class="literal"><span class="pre">remove_cv<remove_reference<reference></span> <span class="pre">>::type</span></tt>.</p>
|
||||
</div>
|
||||
<div class="section" id="transform-iterator-operations">
|
||||
<h3><a class="toc-backref" href="#id55" name="transform-iterator-operations"><tt class="literal"><span class="pre">transform_iterator</span></tt> operations</a></h3>
|
||||
<h4><a class="toc-backref" href="#id55" name="transform-iterator-operations"><tt class="literal"><span class="pre">transform_iterator</span></tt> operations</a></h4>
|
||||
<p><tt class="literal"><span class="pre">transform_iterator();</span></tt></p>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@ -1878,6 +1650,7 @@ transform_iterator(
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="filter-iterator">
|
||||
<h3><a class="toc-backref" href="#id56" name="filter-iterator">Filter iterator</a></h3>
|
||||
<p>The filter iterator adaptor creates a view of an iterator range in
|
||||
@ -1921,9 +1694,8 @@ class filter_iterator
|
||||
corresponding to each standard concept modeled by <tt class="literal"><span class="pre">filter_iterator</span></tt>,
|
||||
as described in the models section.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="filter-iterator-requirements">
|
||||
<h3><a class="toc-backref" href="#id58" name="filter-iterator-requirements"><tt class="literal"><span class="pre">filter_iterator</span></tt> requirements</a></h3>
|
||||
<h4><a class="toc-backref" href="#id58" name="filter-iterator-requirements"><tt class="literal"><span class="pre">filter_iterator</span></tt> requirements</a></h4>
|
||||
<p>The <tt class="literal"><span class="pre">Predicate</span></tt> argument must be Assignable, Copy Constructible, and
|
||||
the expression <tt class="literal"><span class="pre">p(x)</span></tt> must be valid where <tt class="literal"><span class="pre">p</span></tt> is an object of type
|
||||
<tt class="literal"><span class="pre">Predicate</span></tt>, <tt class="literal"><span class="pre">x</span></tt> is an object of type
|
||||
@ -1934,7 +1706,7 @@ Iterator and Single Pass Iterator or it shall meet the requirements of
|
||||
Input Iterator.</p>
|
||||
</div>
|
||||
<div class="section" id="filter-iterator-models">
|
||||
<h3><a class="toc-backref" href="#id59" name="filter-iterator-models"><tt class="literal"><span class="pre">filter_iterator</span></tt> models</a></h3>
|
||||
<h4><a class="toc-backref" href="#id59" name="filter-iterator-models"><tt class="literal"><span class="pre">filter_iterator</span></tt> models</a></h4>
|
||||
<p>The concepts that <tt class="literal"><span class="pre">filter_iterator</span></tt> models are dependent on what
|
||||
concepts the <tt class="literal"><span class="pre">Iterator</span></tt> argument models, as specified in the
|
||||
following tables.</p>
|
||||
@ -2003,7 +1775,7 @@ following tables.</p>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section" id="filter-iterator-operations">
|
||||
<h3><a class="toc-backref" href="#id60" name="filter-iterator-operations"><tt class="literal"><span class="pre">filter_iterator</span></tt> operations</a></h3>
|
||||
<h4><a class="toc-backref" href="#id60" name="filter-iterator-operations"><tt class="literal"><span class="pre">filter_iterator</span></tt> operations</a></h4>
|
||||
<p>In addition to those operations required by the concepts that
|
||||
<tt class="literal"><span class="pre">filter_iterator</span></tt> models, <tt class="literal"><span class="pre">filter_iterator</span></tt> provides the following
|
||||
operations.</p>
|
||||
@ -2106,6 +1878,7 @@ or <tt class="literal"><span class="pre">f(**this)</span> <span class="pre">==</
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="counting-iterator">
|
||||
<h3><a class="toc-backref" href="#id61" name="counting-iterator">Counting iterator</a></h3>
|
||||
<p><tt class="literal"><span class="pre">counting_iterator</span></tt> adapts an arithmetic type, such as <tt class="literal"><span class="pre">int</span></tt>, by
|
||||
@ -2135,15 +1908,14 @@ class counting_iterator
|
||||
the cases when the <tt class="literal"><span class="pre">Incrementable</span></tt> type is a numeric type.]</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="counting-iterator-requirements">
|
||||
<h3><a class="toc-backref" href="#id63" name="counting-iterator-requirements"><tt class="literal"><span class="pre">counting_iterator</span></tt> requirements</a></h3>
|
||||
<h4><a class="toc-backref" href="#id63" name="counting-iterator-requirements"><tt class="literal"><span class="pre">counting_iterator</span></tt> requirements</a></h4>
|
||||
<p>The <tt class="literal"><span class="pre">Incrementable</span></tt> type must be Default Constructible, Copy
|
||||
Constructible, and Assignable. The default distance is
|
||||
an implementation defined signed integral type.</p>
|
||||
</div>
|
||||
<div class="section" id="counting-iterator-models">
|
||||
<h3><a class="toc-backref" href="#id64" name="counting-iterator-models"><tt class="literal"><span class="pre">counting_iterator</span></tt> models</a></h3>
|
||||
<h4><a class="toc-backref" href="#id64" name="counting-iterator-models"><tt class="literal"><span class="pre">counting_iterator</span></tt> models</a></h4>
|
||||
<p><tt class="literal"><span class="pre">counting_iterator</span></tt> models Readable Lvalue Iterator.</p>
|
||||
<p>Furthermore, if you wish to create a counting iterator that is a Forward
|
||||
Traversal Iterator, then the following expressions must be valid:</p>
|
||||
@ -2168,7 +1940,7 @@ i < j
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section" id="counting-iterator-operations">
|
||||
<h3><a class="toc-backref" href="#id65" name="counting-iterator-operations"><tt class="literal"><span class="pre">counting_iterator</span></tt> operations</a></h3>
|
||||
<h4><a class="toc-backref" href="#id65" name="counting-iterator-operations"><tt class="literal"><span class="pre">counting_iterator</span></tt> operations</a></h4>
|
||||
<p><tt class="literal"><span class="pre">counting_iterator();</span></tt></p>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@ -2225,6 +1997,7 @@ constructed from <tt class="literal"><span class="pre">x</span></tt>.</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="function-output-iterator">
|
||||
<h3><a class="toc-backref" href="#id66" name="function-output-iterator">Function output iterator</a></h3>
|
||||
<p>The function output iterator adaptor makes it easier to create custom
|
||||
@ -2261,9 +2034,8 @@ public:
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="function-output-iterator-requirements">
|
||||
<h3><a class="toc-backref" href="#id68" name="function-output-iterator-requirements"><tt class="literal"><span class="pre">function_output_iterator</span></tt> requirements</a></h3>
|
||||
<h4><a class="toc-backref" href="#id68" name="function-output-iterator-requirements"><tt class="literal"><span class="pre">function_output_iterator</span></tt> requirements</a></h4>
|
||||
<p>The <tt class="literal"><span class="pre">UnaryFunction</span></tt> must be Assignable, Copy Constructible, and the
|
||||
expression <tt class="literal"><span class="pre">f(x)</span></tt> must be valid, where <tt class="literal"><span class="pre">f</span></tt> is an object of type
|
||||
<tt class="literal"><span class="pre">UnaryFunction</span></tt> and <tt class="literal"><span class="pre">x</span></tt> is an object of a type accepted by <tt class="literal"><span class="pre">f</span></tt>.
|
||||
@ -2271,7 +2043,7 @@ The resulting <tt class="literal"><span class="pre">function_output_iterator</sp
|
||||
and Incrementable Iterator concepts.</p>
|
||||
</div>
|
||||
<div class="section" id="function-output-iterator-operations">
|
||||
<h3><a class="toc-backref" href="#id69" name="function-output-iterator-operations"><tt class="literal"><span class="pre">function_output_iterator</span></tt> operations</a></h3>
|
||||
<h4><a class="toc-backref" href="#id69" name="function-output-iterator-operations"><tt class="literal"><span class="pre">function_output_iterator</span></tt> operations</a></h4>
|
||||
<p><tt class="literal"><span class="pre">explicit</span> <span class="pre">function_output_iterator(const</span> <span class="pre">UnaryFunction&</span> <span class="pre">f</span> <span class="pre">=</span> <span class="pre">UnaryFunction());</span></tt></p>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@ -2312,7 +2084,7 @@ a copy of the unary function <tt class="literal"><span class="pre">f</span></tt>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section" id="function-output-iterator-output-proxy-operations">
|
||||
<h3><a class="toc-backref" href="#id70" name="function-output-iterator-output-proxy-operations"><tt class="literal"><span class="pre">function_output_iterator::output_proxy</span></tt> operations</a></h3>
|
||||
<h4><a class="toc-backref" href="#id70" name="function-output-iterator-output-proxy-operations"><tt class="literal"><span class="pre">function_output_iterator::output_proxy</span></tt> operations</a></h4>
|
||||
<p><tt class="literal"><span class="pre">output_proxy(UnaryFunction&</span> <span class="pre">f);</span></tt></p>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@ -2346,11 +2118,6 @@ LocalWords: OtherIncrementable Coplien -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="footer" />
|
||||
<div class="footer">
|
||||
<a class="reference" href="facade-and-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>
|
||||
</html>
|
||||
|
@ -3,240 +3,13 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils 0.3.0: http://docutils.sourceforge.net/" />
|
||||
<title>Filter Iterator</title>
|
||||
<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="date" content="2004-01-12" />
|
||||
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
||||
<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>
|
||||
<link rel="stylesheet" href="default.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="filter-iterator">
|
||||
@ -307,8 +80,13 @@ class filter_iterator
|
||||
);
|
||||
Predicate predicate() const;
|
||||
Iterator end() const;
|
||||
Iterator base() const;
|
||||
reference operator*() const;
|
||||
filter_iterator& operator++();
|
||||
private:
|
||||
Predicate m_pred; // exposition
|
||||
Iterator m_iter; // exposition
|
||||
Iterator m_end; // exposition
|
||||
};
|
||||
</pre>
|
||||
<p>The <tt class="literal"><span class="pre">iterator_category</span></tt> member is a type convertible to the tags
|
||||
@ -406,9 +184,8 @@ operations.</p>
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="literal"><span class="pre">Predicate</span></tt> and <tt class="literal"><span class="pre">Iterator</span></tt> must be Default Constructible.</td>
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">a <tt class="literal"><span class="pre">filter_iterator</span></tt> whose
|
||||
predicate is a default constructed <tt class="literal"><span class="pre">Predicate</span></tt> and
|
||||
whose <tt class="literal"><span class="pre">end</span></tt> is a default constructed <tt class="literal"><span class="pre">Iterator</span></tt>.</td>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">a <tt class="literal"><span class="pre">filter_iterator</span></tt> whose``m_pred``, <tt class="literal"><span class="pre">m_iter</span></tt>, and <tt class="literal"><span class="pre">m_end</span></tt>
|
||||
members are a default constructed.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -417,8 +194,10 @@ whose <tt class="literal"><span class="pre">end</span></tt> is a default constru
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">A <tt class="literal"><span class="pre">filter_iterator</span></tt> at the first position in the range <tt class="literal"><span class="pre">[x,end)</span></tt>
|
||||
such that <tt class="literal"><span class="pre">f(*this->base())</span> <span class="pre">==</span> <span class="pre">true</span></tt> or else at position <tt class="literal"><span class="pre">end</span></tt>.</td>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">A <tt class="literal"><span class="pre">filter_iterator</span></tt> where <tt class="literal"><span class="pre">m_iter</span></tt> is either
|
||||
the first position in the range <tt class="literal"><span class="pre">[x,end)</span></tt> such that <tt class="literal"><span class="pre">f(*m_iter)</span> <span class="pre">==</span> <span class="pre">true</span></tt>
|
||||
or else``m_iter == end``. The member <tt class="literal"><span class="pre">m_pred</span></tt> is constructed from
|
||||
<tt class="literal"><span class="pre">f</span></tt> and <tt class="literal"><span class="pre">m_end</span></tt> from <tt class="literal"><span class="pre">end</span></tt>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -429,13 +208,9 @@ such that <tt class="literal"><span class="pre">f(*this->base())</span> <span
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="literal"><span class="pre">Predicate</span></tt> must be Default Constructible.</td>
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">A <tt class="literal"><span class="pre">filter_iterator</span></tt> at the first position in the range <tt class="literal"><span class="pre">[x,end)</span></tt>
|
||||
such that <tt class="literal"><span class="pre">f(*this->base())</span> <span class="pre">==</span> <span class="pre">true</span></tt>, where <tt class="literal"><span class="pre">f</span></tt> is a default
|
||||
constructed <tt class="literal"><span class="pre">Predicate</span></tt>, or else at position <tt class="literal"><span class="pre">end</span></tt>.</td>
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">A <tt class="literal"><span class="pre">filter_iterator</span></tt> at position <tt class="literal"><span class="pre">x</span></tt> that filters
|
||||
according to a default constructed <tt class="literal"><span class="pre">Predicate</span></tt>
|
||||
and that will not increment past <tt class="literal"><span class="pre">end</span></tt>.</td>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">A <tt class="literal"><span class="pre">filter_iterator</span></tt> where <tt class="literal"><span class="pre">m_iter</span></tt> is either
|
||||
the first position in the range <tt class="literal"><span class="pre">[x,end)</span></tt> such that <tt class="literal"><span class="pre">m_pred(*m_iter)</span> <span class="pre">==</span> <span class="pre">true</span></tt>
|
||||
or else``m_iter == end``. The member <tt class="literal"><span class="pre">m_pred</span></tt> is default constructed.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -452,8 +227,7 @@ filter_iterator(
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="literal"><span class="pre">OtherIterator</span></tt> is implicitly convertible to <tt class="literal"><span class="pre">Iterator</span></tt>.</td>
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">A filter iterator at the same position as iterator <tt class="literal"><span class="pre">t</span></tt>
|
||||
whose predicate and end are copies of <tt class="literal"><span class="pre">t.predicate</span></tt> and <tt class="literal"><span class="pre">t.end()</span></tt> .</td>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">A filter iterator whose members are copied from <tt class="literal"><span class="pre">t</span></tt>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -462,7 +236,7 @@ whose predicate and end are copies of <tt class="literal"><span class="pre">t.pr
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">A copy of the predicate object used to construct <tt class="literal"><span class="pre">*this</span></tt>.</td>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">m_pred</span></tt></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -471,7 +245,16 @@ whose predicate and end are copies of <tt class="literal"><span class="pre">t.pr
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">A copy of the object <tt class="literal"><span class="pre">end</span></tt> used to construct <tt class="literal"><span class="pre">*this</span></tt>.</td>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">m_end</span></tt></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><tt class="literal"><span class="pre">Iterator</span> <span class="pre">base()</span> <span class="pre">const;</span></tt></p>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">m_iterator</span></tt></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -480,7 +263,7 @@ whose predicate and end are copies of <tt class="literal"><span class="pre">t.pr
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">*(this->base())</span></tt></td>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">*m_iter</span></tt></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -489,9 +272,9 @@ whose predicate and end are copies of <tt class="literal"><span class="pre">t.pr
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Effects:</th><td class="field-body">Increments <tt class="literal"><span class="pre">*this</span></tt> and then continues to
|
||||
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>
|
||||
<tr class="field"><th class="field-name">Effects:</th><td class="field-body">Increments <tt class="literal"><span class="pre">m_iter</span></tt> and then continues to
|
||||
increment <tt class="literal"><span class="pre">m_iter</span></tt> until either <tt class="literal"><span class="pre">m_iter</span> <span class="pre">==</span> <span class="pre">m_end</span></tt>
|
||||
or <tt class="literal"><span class="pre">m_pred(*m_iter)</span> <span class="pre">==</span> <span class="pre">true</span></tt>.</td>
|
||||
</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>
|
||||
@ -591,11 +374,5 @@ int main()
|
||||
</pre>
|
||||
</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>
|
||||
</html>
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
Example
|
||||
-------
|
||||
.......
|
||||
|
||||
This example uses ``filter_iterator`` and then
|
||||
``make_filter_iterator`` to output only the positive integers from an
|
||||
|
@ -20,8 +20,13 @@
|
||||
);
|
||||
Predicate predicate() const;
|
||||
Iterator end() const;
|
||||
Iterator base() const;
|
||||
reference operator*() const;
|
||||
filter_iterator& operator++();
|
||||
private:
|
||||
Predicate m_pred; // exposition
|
||||
Iterator m_iter; // exposition
|
||||
Iterator m_end; // exposition
|
||||
};
|
||||
|
||||
|
||||
@ -32,7 +37,7 @@ as described in the models section.
|
||||
|
||||
|
||||
``filter_iterator`` requirements
|
||||
--------------------------------
|
||||
................................
|
||||
|
||||
The ``Predicate`` argument must be Assignable, Copy Constructible, and
|
||||
the expression ``p(x)`` must be valid where ``p`` is an object of type
|
||||
@ -47,7 +52,7 @@ Input Iterator.
|
||||
|
||||
|
||||
``filter_iterator`` models
|
||||
--------------------------
|
||||
..........................
|
||||
|
||||
The concepts that ``filter_iterator`` models are dependent on what
|
||||
concepts the ``Iterator`` argument models, as specified in the
|
||||
@ -83,7 +88,7 @@ following tables.
|
||||
|
||||
|
||||
``filter_iterator`` operations
|
||||
------------------------------
|
||||
..............................
|
||||
|
||||
In addition to those operations required by the concepts that
|
||||
``filter_iterator`` models, ``filter_iterator`` provides the following
|
||||
@ -93,28 +98,25 @@ operations.
|
||||
``filter_iterator();``
|
||||
|
||||
:Requires: ``Predicate`` and ``Iterator`` must be Default Constructible.
|
||||
:Returns: a ``filter_iterator`` whose
|
||||
predicate is a default constructed ``Predicate`` and
|
||||
whose ``end`` is a default constructed ``Iterator``.
|
||||
:Returns: a ``filter_iterator`` whose``m_pred``, ``m_iter``, and ``m_end``
|
||||
members are a default constructed.
|
||||
|
||||
|
||||
``filter_iterator(Predicate f, Iterator x, Iterator end = Iterator());``
|
||||
|
||||
:Returns: A ``filter_iterator`` at the first position in the range ``[x,end)``
|
||||
such that ``f(*this->base()) == true`` or else at position ``end``.
|
||||
:Returns: A ``filter_iterator`` where ``m_iter`` is either
|
||||
the first position in the range ``[x,end)`` such that ``f(*m_iter) == true``
|
||||
or else``m_iter == end``. The member ``m_pred`` is constructed from
|
||||
``f`` and ``m_end`` from ``end``.
|
||||
|
||||
|
||||
|
||||
``filter_iterator(Iterator x, Iterator end = Iterator());``
|
||||
|
||||
:Requires: ``Predicate`` must be Default Constructible.
|
||||
:Returns: A ``filter_iterator`` at the first position in the range ``[x,end)``
|
||||
such that ``f(*this->base()) == true``, where ``f`` is a default
|
||||
constructed ``Predicate``, or else at position ``end``.
|
||||
|
||||
|
||||
:Returns: A ``filter_iterator`` at position ``x`` that filters
|
||||
according to a default constructed ``Predicate``
|
||||
and that will not increment past ``end``.
|
||||
:Returns: A ``filter_iterator`` where ``m_iter`` is either
|
||||
the first position in the range ``[x,end)`` such that ``m_pred(*m_iter) == true``
|
||||
or else``m_iter == end``. The member ``m_pred`` is default constructed.
|
||||
|
||||
|
||||
::
|
||||
@ -126,29 +128,33 @@ operations.
|
||||
);``
|
||||
|
||||
:Requires: ``OtherIterator`` is implicitly convertible to ``Iterator``.
|
||||
:Returns: A filter iterator at the same position as iterator ``t``
|
||||
whose predicate and end are copies of ``t.predicate`` and ``t.end()`` .
|
||||
:Returns: A filter iterator whose members are copied from ``t``.
|
||||
|
||||
|
||||
``Predicate predicate() const;``
|
||||
|
||||
:Returns: A copy of the predicate object used to construct ``*this``.
|
||||
:Returns: ``m_pred``
|
||||
|
||||
|
||||
``Iterator end() const;``
|
||||
|
||||
:Returns: A copy of the object ``end`` used to construct ``*this``.
|
||||
:Returns: ``m_end``
|
||||
|
||||
|
||||
``Iterator base() const;``
|
||||
|
||||
:Returns: ``m_iterator``
|
||||
|
||||
|
||||
|
||||
``reference operator*() const;``
|
||||
|
||||
:Returns: ``*(this->base())``
|
||||
:Returns: ``*m_iter``
|
||||
|
||||
|
||||
``filter_iterator& operator++();``
|
||||
|
||||
:Effects: Increments ``*this`` and then continues to
|
||||
increment ``*this`` until either ``this->base() == this->end()``
|
||||
or ``f(**this) == true``.
|
||||
:Effects: Increments ``m_iter`` and then continues to
|
||||
increment ``m_iter`` until either ``m_iter == m_end``
|
||||
or ``m_pred(*m_iter) == true``.
|
||||
:Returns: ``*this``
|
@ -3,240 +3,13 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils 0.3.0: http://docutils.sourceforge.net/" />
|
||||
<title>Function Output Iterator</title>
|
||||
<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="date" content="2003-09-14" />
|
||||
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
||||
<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>
|
||||
<link rel="stylesheet" href="default.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="function-output-iterator">
|
||||
@ -280,6 +53,7 @@ proxy object.</p>
|
||||
<li><a class="reference" href="#function-output-iterator-requirements" id="id1" name="id1"><tt class="literal"><span class="pre">function_output_iterator</span></tt> requirements</a></li>
|
||||
<li><a class="reference" href="#function-output-iterator-operations" id="id2" name="id2"><tt class="literal"><span class="pre">function_output_iterator</span></tt> operations</a></li>
|
||||
<li><a class="reference" href="#function-output-iterator-output-proxy-operations" id="id3" name="id3"><tt class="literal"><span class="pre">function_output_iterator::output_proxy</span></tt> operations</a></li>
|
||||
<li><a class="reference" href="#example" id="id4" name="id4">Example</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<pre class="literal-block">
|
||||
@ -381,12 +155,41 @@ return *this;
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section" id="example">
|
||||
<h1><a class="toc-backref" href="#id4" name="example">Example</a></h1>
|
||||
<pre class="literal-block">
|
||||
struct string_appender
|
||||
{
|
||||
string_appender(std::string& s)
|
||||
: m_str(&s)
|
||||
{}
|
||||
|
||||
void operator()(const std::string& x) const
|
||||
{
|
||||
*m_str += x;
|
||||
}
|
||||
|
||||
std::string* m_str;
|
||||
};
|
||||
|
||||
int main(int, char*[])
|
||||
{
|
||||
std::vector<std::string> x;
|
||||
x.push_back("hello");
|
||||
x.push_back(" ");
|
||||
x.push_back("world");
|
||||
x.push_back("!");
|
||||
|
||||
std::string s = "";
|
||||
std::copy(x.begin(), x.end(),
|
||||
boost::make_function_output_iterator(string_appender(s)));
|
||||
|
||||
std::cout << s << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
</pre>
|
||||
</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>
|
||||
</html>
|
||||
|
@ -21,3 +21,4 @@
|
||||
.. contents:: Table of Contents
|
||||
|
||||
.. include:: function_output_iterator_ref.rst
|
||||
.. include:: function_output_iterator_eg.rst
|
35
doc/function_output_iterator_eg.rst
Normal file
35
doc/function_output_iterator_eg.rst
Normal file
@ -0,0 +1,35 @@
|
||||
Example
|
||||
.......
|
||||
|
||||
::
|
||||
|
||||
struct string_appender
|
||||
{
|
||||
string_appender(std::string& s)
|
||||
: m_str(&s)
|
||||
{}
|
||||
|
||||
void operator()(const std::string& x) const
|
||||
{
|
||||
*m_str += x;
|
||||
}
|
||||
|
||||
std::string* m_str;
|
||||
};
|
||||
|
||||
int main(int, char*[])
|
||||
{
|
||||
std::vector<std::string> x;
|
||||
x.push_back("hello");
|
||||
x.push_back(" ");
|
||||
x.push_back("world");
|
||||
x.push_back("!");
|
||||
|
||||
std::string s = "";
|
||||
std::copy(x.begin(), x.end(),
|
||||
boost::make_function_output_iterator(string_appender(s)));
|
||||
|
||||
std::cout << s << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
@ -25,7 +25,7 @@
|
||||
|
||||
|
||||
``function_output_iterator`` requirements
|
||||
-----------------------------------------
|
||||
.........................................
|
||||
|
||||
The ``UnaryFunction`` must be Assignable, Copy Constructible, and the
|
||||
expression ``f(x)`` must be valid, where ``f`` is an object of type
|
||||
@ -35,7 +35,7 @@ and Incrementable Iterator concepts.
|
||||
|
||||
|
||||
``function_output_iterator`` operations
|
||||
---------------------------------------
|
||||
.......................................
|
||||
|
||||
``explicit function_output_iterator(const UnaryFunction& f = UnaryFunction());``
|
||||
|
||||
@ -60,7 +60,7 @@ and Incrementable Iterator concepts.
|
||||
|
||||
|
||||
``function_output_iterator::output_proxy`` operations
|
||||
-----------------------------------------------------
|
||||
.....................................................
|
||||
|
||||
``output_proxy(UnaryFunction& f);``
|
||||
|
||||
|
@ -3,240 +3,13 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils 0.3.0: http://docutils.sourceforge.net/" />
|
||||
<title>Indirect Iterator</title>
|
||||
<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="date" content="2003-09-14" />
|
||||
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
||||
<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>
|
||||
<link rel="stylesheet" href="default.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="indirect-iterator">
|
||||
@ -280,6 +53,7 @@ iterators over smart pointers, which the impl handles. -JGS -->
|
||||
<li><a class="reference" href="#indirect-iterator-requirements" id="id1" name="id1"><tt class="literal"><span class="pre">indirect_iterator</span></tt> requirements</a></li>
|
||||
<li><a class="reference" href="#indirect-iterator-models" id="id2" name="id2"><tt class="literal"><span class="pre">indirect_iterator</span></tt> models</a></li>
|
||||
<li><a class="reference" href="#indirect-iterator-operations" id="id3" name="id3"><tt class="literal"><span class="pre">indirect_iterator</span></tt> operations</a></li>
|
||||
<li><a class="reference" href="#example" id="id4" name="id4">Example</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<pre class="literal-block">
|
||||
@ -312,6 +86,10 @@ class indirect_iterator
|
||||
> const& y
|
||||
, typename enable_if_convertible<Iterator2, Iterator>::type* = 0 // exposition
|
||||
);
|
||||
|
||||
Iterator base() const;
|
||||
private:
|
||||
Iterator m_iterator; // exposition
|
||||
};
|
||||
</pre>
|
||||
<p>The member types of <tt class="literal"><span class="pre">indirect_iterator</span></tt> are defined according to the
|
||||
@ -384,7 +162,7 @@ the <tt class="literal"><span class="pre">Iterator</span></tt> argument.</p>
|
||||
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="literal"><span class="pre">Iterator</span></tt> must be Default Constructible.</td>
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">indirect_iterator</span></tt> with
|
||||
a default-constructed <tt class="literal"><span class="pre">iterator_adaptor</span></tt> subobject.</td>
|
||||
a default-constructed <tt class="literal"><span class="pre">m_iterator</span></tt>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -394,7 +172,7 @@ a default-constructed <tt class="literal"><span class="pre">iterator_adaptor</sp
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">indirect_iterator</span></tt> with
|
||||
the <tt class="literal"><span class="pre">iterator_adaptor</span></tt> subobject copy constructed from <tt class="literal"><span class="pre">x</span></tt>.</td>
|
||||
<tt class="literal"><span class="pre">m_iterator</span></tt> copy constructed from <tt class="literal"><span class="pre">x</span></tt>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -417,17 +195,72 @@ indirect_iterator(
|
||||
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="literal"><span class="pre">Iterator2</span></tt> is implicitly convertible to <tt class="literal"><span class="pre">Iterator</span></tt>.</td>
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">indirect_iterator</span></tt> whose
|
||||
<tt class="literal"><span class="pre">iterator_adaptor</span></tt> subobject is constructed from <tt class="literal"><span class="pre">y.base()</span></tt>.</td>
|
||||
<tt class="literal"><span class="pre">m_iterator</span></tt> subobject is constructed from <tt class="literal"><span class="pre">y.base()</span></tt>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><tt class="literal"><span class="pre">Iterator</span> <span class="pre">base()</span> <span class="pre">const;</span></tt></p>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">m_iterator</span></tt></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section" id="example">
|
||||
<h1><a class="toc-backref" href="#id4" name="example">Example</a></h1>
|
||||
<pre class="literal-block">
|
||||
char characters[] = "abcdefg";
|
||||
const int N = sizeof(characters)/sizeof(char) - 1; // -1 since characters has a null char
|
||||
char* pointers_to_chars[N]; // at the end.
|
||||
for (int i = 0; i < N; ++i)
|
||||
pointers_to_chars[i] = &characters[i];
|
||||
|
||||
// Example of using indirect_iterator
|
||||
|
||||
boost::indirect_iterator<char**, char>
|
||||
indirect_first(pointers_to_chars), indirect_last(pointers_to_chars + N);
|
||||
|
||||
std::copy(indirect_first, indirect_last, std::ostream_iterator<char>(std::cout, ","));
|
||||
std::cout << std::endl;
|
||||
|
||||
|
||||
// Example of making mutable and constant indirect iterators
|
||||
|
||||
char mutable_characters[N];
|
||||
char* pointers_to_mutable_chars[N];
|
||||
for (int j = 0; j < N; ++j)
|
||||
pointers_to_mutable_chars[j] = &mutable_characters[j];
|
||||
|
||||
boost::indirect_iterator<char* const*> mutable_indirect_first(pointers_to_mutable_chars),
|
||||
mutable_indirect_last(pointers_to_mutable_chars + N);
|
||||
boost::indirect_iterator<char* const*, char const> const_indirect_first(pointers_to_chars),
|
||||
const_indirect_last(pointers_to_chars + N);
|
||||
|
||||
std::transform(const_indirect_first, const_indirect_last,
|
||||
mutable_indirect_first, std::bind1st(std::plus<char>(), 1));
|
||||
|
||||
std::copy(mutable_indirect_first, mutable_indirect_last,
|
||||
std::ostream_iterator<char>(std::cout, ","));
|
||||
std::cout << std::endl;
|
||||
|
||||
|
||||
// Example of using make_indirect_iterator()
|
||||
|
||||
std::copy(boost::make_indirect_iterator(pointers_to_chars),
|
||||
boost::make_indirect_iterator(pointers_to_chars + N),
|
||||
std::ostream_iterator<char>(std::cout, ","));
|
||||
std::cout << std::endl;
|
||||
</pre>
|
||||
<p>The output is:</p>
|
||||
<pre class="literal-block">
|
||||
a,b,c,d,e,f,g,
|
||||
b,c,d,e,f,g,h,
|
||||
a,b,c,d,e,f,g,
|
||||
</pre>
|
||||
</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>
|
||||
</html>
|
||||
|
@ -21,3 +21,4 @@
|
||||
.. contents:: Table of Contents
|
||||
|
||||
.. include:: indirect_iterator_ref.rst
|
||||
.. include:: indirect_iterator_eg.rst
|
||||
|
54
doc/indirect_iterator_eg.rst
Normal file
54
doc/indirect_iterator_eg.rst
Normal file
@ -0,0 +1,54 @@
|
||||
Example
|
||||
.......
|
||||
|
||||
|
||||
::
|
||||
|
||||
char characters[] = "abcdefg";
|
||||
const int N = sizeof(characters)/sizeof(char) - 1; // -1 since characters has a null char
|
||||
char* pointers_to_chars[N]; // at the end.
|
||||
for (int i = 0; i < N; ++i)
|
||||
pointers_to_chars[i] = &characters[i];
|
||||
|
||||
// Example of using indirect_iterator
|
||||
|
||||
boost::indirect_iterator<char**, char>
|
||||
indirect_first(pointers_to_chars), indirect_last(pointers_to_chars + N);
|
||||
|
||||
std::copy(indirect_first, indirect_last, std::ostream_iterator<char>(std::cout, ","));
|
||||
std::cout << std::endl;
|
||||
|
||||
|
||||
// Example of making mutable and constant indirect iterators
|
||||
|
||||
char mutable_characters[N];
|
||||
char* pointers_to_mutable_chars[N];
|
||||
for (int j = 0; j < N; ++j)
|
||||
pointers_to_mutable_chars[j] = &mutable_characters[j];
|
||||
|
||||
boost::indirect_iterator<char* const*> mutable_indirect_first(pointers_to_mutable_chars),
|
||||
mutable_indirect_last(pointers_to_mutable_chars + N);
|
||||
boost::indirect_iterator<char* const*, char const> const_indirect_first(pointers_to_chars),
|
||||
const_indirect_last(pointers_to_chars + N);
|
||||
|
||||
std::transform(const_indirect_first, const_indirect_last,
|
||||
mutable_indirect_first, std::bind1st(std::plus<char>(), 1));
|
||||
|
||||
std::copy(mutable_indirect_first, mutable_indirect_last,
|
||||
std::ostream_iterator<char>(std::cout, ","));
|
||||
std::cout << std::endl;
|
||||
|
||||
|
||||
// Example of using make_indirect_iterator()
|
||||
|
||||
std::copy(boost::make_indirect_iterator(pointers_to_chars),
|
||||
boost::make_indirect_iterator(pointers_to_chars + N),
|
||||
std::ostream_iterator<char>(std::cout, ","));
|
||||
std::cout << std::endl;
|
||||
|
||||
|
||||
The output is::
|
||||
|
||||
a,b,c,d,e,f,g,
|
||||
b,c,d,e,f,g,h,
|
||||
a,b,c,d,e,f,g,
|
@ -29,6 +29,10 @@
|
||||
> const& y
|
||||
, typename enable_if_convertible<Iterator2, Iterator>::type* = 0 // exposition
|
||||
);
|
||||
|
||||
Iterator base() const;
|
||||
private:
|
||||
Iterator m_iterator; // exposition
|
||||
};
|
||||
|
||||
|
||||
@ -108,13 +112,13 @@ the ``Iterator`` argument.
|
||||
|
||||
:Requires: ``Iterator`` must be Default Constructible.
|
||||
:Returns: An instance of ``indirect_iterator`` with
|
||||
a default-constructed ``iterator_adaptor`` subobject.
|
||||
a default-constructed ``m_iterator``.
|
||||
|
||||
|
||||
``indirect_iterator(Iterator x);``
|
||||
|
||||
:Returns: An instance of ``indirect_iterator`` with
|
||||
the ``iterator_adaptor`` subobject copy constructed from ``x``.
|
||||
``m_iterator`` copy constructed from ``x``.
|
||||
|
||||
::
|
||||
|
||||
@ -131,6 +135,9 @@ the ``Iterator`` argument.
|
||||
|
||||
:Requires: ``Iterator2`` is implicitly convertible to ``Iterator``.
|
||||
:Returns: An instance of ``indirect_iterator`` whose
|
||||
``iterator_adaptor`` subobject is constructed from ``y.base()``.
|
||||
``m_iterator`` subobject is constructed from ``y.base()``.
|
||||
|
||||
|
||||
``Iterator base() const;``
|
||||
|
||||
:Returns: ``m_iterator``
|
||||
|
@ -3,240 +3,13 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils 0.3.0: http://docutils.sourceforge.net/" />
|
||||
<title>Permutation Iterator</title>
|
||||
<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="date" content="2003-09-14" />
|
||||
<meta name="date" content="2004-01-12" />
|
||||
<meta name="copyright" content="Copyright Toon Knapen, David Abrahams, Roland Richter, and Jeremy Siek 2003. All rights reserved" />
|
||||
<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>
|
||||
<link rel="stylesheet" href="default.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="permutation-iterator">
|
||||
@ -253,7 +26,7 @@ ul.auto-toc {
|
||||
<td><a class="first reference" href="http://www.boost-consulting.com">Boost Consulting</a>, Indiana University <a class="last reference" href="http://www.osl.iu.edu">Open Systems
|
||||
Lab</a></td></tr>
|
||||
<tr><th class="docinfo-name">Date:</th>
|
||||
<td>2003-09-14</td></tr>
|
||||
<td>2004-01-12</td></tr>
|
||||
<tr><th class="docinfo-name">Copyright:</th>
|
||||
<td>Copyright Toon Knapen, David Abrahams, Roland Richter, and Jeremy Siek 2003. All rights reserved</td></tr>
|
||||
</tbody>
|
||||
@ -278,6 +51,7 @@ in a potentially different order.</p>
|
||||
<li><a class="reference" href="#permutation-iterator-operations" id="id7" name="id7"><tt class="literal"><span class="pre">permutation_iterator</span></tt> operations</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#example" id="id8" name="id8">Example</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="introduction">
|
||||
@ -306,15 +80,11 @@ past-the-end iterator to the indices.</p>
|
||||
template< class ElementIterator
|
||||
, class IndexIterator
|
||||
, class ValueT = use_default
|
||||
, unsigned access = use_default_access
|
||||
, class Traversal = use_default
|
||||
, class CategoryT = use_default
|
||||
, class ReferenceT = use_default
|
||||
, class DifferenceT = use_default >
|
||||
class permutation_iterator
|
||||
: public iterator_adaptor<...>
|
||||
{
|
||||
typedef iterator_adaptor<...>
|
||||
friend class iterator_core_access;
|
||||
public:
|
||||
permutation_iterator();
|
||||
explicit permutation_iterator(ElementIterator x, IndexIterator y);
|
||||
@ -325,7 +95,14 @@ public:
|
||||
, typename enable_if_convertible<OEIter, ElementIterator>::type* = 0
|
||||
, typename enable_if_convertible<OIIter, IndexIterator>::type* = 0
|
||||
);
|
||||
ElementIterator base() const;
|
||||
private:
|
||||
ElementIterator m_iterator; // exposition
|
||||
};
|
||||
|
||||
template <class ElementIterator, class IndexIterator>
|
||||
permutation_iterator<ElementIterator, IndexIterator>
|
||||
make_permutation_iterator( ElementIterator e, IndexIterator i);
|
||||
</pre>
|
||||
<div class="section" id="permutation-iterator-requirements">
|
||||
<h2><a class="toc-backref" href="#id6" name="permutation-iterator-requirements"><tt class="literal"><span class="pre">permutation_iterator</span></tt> requirements</a></h2>
|
||||
@ -343,14 +120,96 @@ same concept as the IndexIterator. Thus for instance, although the
|
||||
permutation iterator provides <tt class="literal"><span class="pre">operator+=(distance)</span></tt>, this operation
|
||||
will take linear time in case the IndexIterator is a model of
|
||||
ForwardIterator instead of amortized constant time.</p>
|
||||
<pre class="literal-block">
|
||||
template <class ElementIterator, class IndexIterator>
|
||||
permutation_iterator<ElementIterator, IndexIterator>
|
||||
make_permutation_iterator(ElementIterator e, IndexIterator i);
|
||||
</pre>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">permutation_iterator<ElementIterator,</span> <span class="pre">IndexIterator></span></tt>
|
||||
that views the range of elements starting at <tt class="literal"><span class="pre">e`</span> <span class="pre">in</span> <span class="pre">the</span> <span class="pre">order</span> <span class="pre">given</span>
|
||||
<span class="pre">by</span> <span class="pre">``i</span></tt>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><tt class="literal"><span class="pre">ElementIterator</span> <span class="pre">base()</span> <span class="pre">const;</span></tt></p>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">m_iterator</span></tt></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="example">
|
||||
<h1><a class="toc-backref" href="#id8" name="example">Example</a></h1>
|
||||
<pre class="literal-block">
|
||||
using namespace boost;
|
||||
int i = 0;
|
||||
|
||||
typedef std::vector< int > element_range_type;
|
||||
typedef std::list< int > index_type;
|
||||
|
||||
static const int element_range_size = 10;
|
||||
static const int index_size = 4;
|
||||
|
||||
element_range_type elements( element_range_size );
|
||||
for(element_range_type::iterator el_it = elements.begin() ; el_it != elements.end() ; ++el_it)
|
||||
*el_it = std::distance(elements.begin(), el_it);
|
||||
|
||||
index_type indices( index_size );
|
||||
for(index_type::iterator i_it = indices.begin() ; i_it != indices.end() ; ++i_it )
|
||||
*i_it = element_range_size - index_size + std::distance(indices.begin(), i_it);
|
||||
std::reverse( indices.begin(), indices.end() );
|
||||
|
||||
typedef permutation_iterator< element_range_type::iterator, index_type::iterator > permutation_type;
|
||||
permutation_type begin = make_permutation_iterator( elements.begin(), indices.begin() );
|
||||
permutation_type it = begin;
|
||||
permutation_type end = make_permutation_iterator( elements.begin(), indices.end() );
|
||||
|
||||
std::cout << "The original range is : ";
|
||||
std::copy( elements.begin(), elements.end(), std::ostream_iterator< int >( std::cout, " " ) );
|
||||
std::cout << "\n";
|
||||
|
||||
std::cout << "The reindexing scheme is : ";
|
||||
std::copy( indices.begin(), indices.end(), std::ostream_iterator< int >( std::cout, " " ) );
|
||||
std::cout << "\n";
|
||||
|
||||
std::cout << "The permutated range is : ";
|
||||
std::copy( begin, end, std::ostream_iterator< int >( std::cout, " " ) );
|
||||
std::cout << "\n";
|
||||
|
||||
std::cout << "Elements at even indices in the permutation : ";
|
||||
it = begin;
|
||||
for(i = 0; i < index_size / 2 ; ++i, it+=2 ) std::cout << *it << " ";
|
||||
std::cout << "\n";
|
||||
|
||||
std::cout << "Permutation backwards : ";
|
||||
it = begin + (index_size);
|
||||
assert( it != begin );
|
||||
for( ; it-- != begin ; ) std::cout << *it << " ";
|
||||
std::cout << "\n";
|
||||
|
||||
std::cout << "Iterate backward with stride 2 : ";
|
||||
it = begin + (index_size - 1);
|
||||
for(i = 0 ; i < index_size / 2 ; ++i, it-=2 ) std::cout << *it << " ";
|
||||
std::cout << "\n";
|
||||
</pre>
|
||||
<p>The output is:</p>
|
||||
<pre class="literal-block">
|
||||
The original range is : 0 1 2 3 4 5 6 7 8 9
|
||||
The reindexing scheme is : 9 8 7 6
|
||||
The permutated range is : 9 8 7 6
|
||||
Elements at even indices in the permutation : 9 7
|
||||
Permutation backwards : 6 7 8 9
|
||||
Iterate backward with stride 2 : 6 8
|
||||
</pre>
|
||||
</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>
|
||||
</html>
|
||||
|
@ -18,6 +18,9 @@
|
||||
, typename enable_if_convertible<OEIter, ElementIterator>::type* = 0
|
||||
, typename enable_if_convertible<OIIter, IndexIterator>::type* = 0
|
||||
);
|
||||
ElementIterator base() const;
|
||||
private:
|
||||
ElementIterator m_iterator; // exposition
|
||||
};
|
||||
|
||||
template <class ElementIterator, class IndexIterator>
|
||||
@ -63,4 +66,9 @@ __ http://www.sgi.com/tech/stl/RandomAccessIterator.html
|
||||
|
||||
:Returns: An instance of ``permutation_iterator<ElementIterator, IndexIterator>``
|
||||
that views the range of elements starting at ``e` in the order given
|
||||
by ``i``.
|
||||
by ``i``.
|
||||
|
||||
|
||||
``ElementIterator base() const;``
|
||||
|
||||
:Returns: ``m_iterator``
|
@ -3,240 +3,13 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils 0.3.0: http://docutils.sourceforge.net/" />
|
||||
<title>Reverse Iterator</title>
|
||||
<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="date" content="2004-01-12" />
|
||||
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
||||
<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>
|
||||
<link rel="stylesheet" href="default.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="reverse-iterator">
|
||||
@ -274,12 +47,14 @@ invoking <tt class="literal"><span class="pre">operator--()</span></tt> moves th
|
||||
<div class="contents topic" id="table-of-contents">
|
||||
<p class="topic-title"><a name="table-of-contents">Table of Contents</a></p>
|
||||
<ul class="simple">
|
||||
<li><a class="reference" href="#reverse-iterator-synopsis" id="id1" name="id1"><tt class="literal"><span class="pre">reverse_iterator</span></tt> synopsis</a></li>
|
||||
<li><a class="reference" href="#reverse-iterator-synopsis" id="id1" name="id1"><tt class="literal"><span class="pre">reverse_iterator</span></tt> synopsis</a><ul>
|
||||
<li><a class="reference" href="#reverse-iterator-requirements" id="id2" name="id2"><tt class="literal"><span class="pre">reverse_iterator</span></tt> requirements</a></li>
|
||||
<li><a class="reference" href="#reverse-iterator-models" id="id3" name="id3"><tt class="literal"><span class="pre">reverse_iterator</span></tt> models</a></li>
|
||||
<li><a class="reference" href="#reverse-iterator-operations" id="id4" name="id4"><tt class="literal"><span class="pre">reverse_iterator</span></tt> operations</a></li>
|
||||
<li><a class="reference" href="#example" id="id5" name="id5">Example</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="reverse-iterator-synopsis">
|
||||
<h1><a class="toc-backref" href="#id1" name="reverse-iterator-synopsis"><tt class="literal"><span class="pre">reverse_iterator</span></tt> synopsis</a></h1>
|
||||
@ -296,27 +71,27 @@ public:
|
||||
reverse_iterator<OtherIterator> const& r
|
||||
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0 // exposition
|
||||
);
|
||||
Iterator base() const;
|
||||
reference operator*() const;
|
||||
reverse_iterator& operator++();
|
||||
private:
|
||||
Iterator current; // exposition
|
||||
Iterator m_iterator; // exposition
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section" id="reverse-iterator-requirements">
|
||||
<h1><a class="toc-backref" href="#id2" name="reverse-iterator-requirements"><tt class="literal"><span class="pre">reverse_iterator</span></tt> requirements</a></h1>
|
||||
<h2><a class="toc-backref" href="#id2" name="reverse-iterator-requirements"><tt class="literal"><span class="pre">reverse_iterator</span></tt> requirements</a></h2>
|
||||
<p>The base <tt class="literal"><span class="pre">Iterator</span></tt> must be a model of Bidirectional Traversal
|
||||
Iterator and Readable Iterator.</p>
|
||||
</div>
|
||||
<div class="section" id="reverse-iterator-models">
|
||||
<h1><a class="toc-backref" href="#id3" name="reverse-iterator-models"><tt class="literal"><span class="pre">reverse_iterator</span></tt> models</a></h1>
|
||||
<h2><a class="toc-backref" href="#id3" name="reverse-iterator-models"><tt class="literal"><span class="pre">reverse_iterator</span></tt> models</a></h2>
|
||||
<p><tt class="literal"><span class="pre">reverse_iterator</span></tt> models Bidirectional Traversal Iterator and
|
||||
Readable Iterator. In addition, <tt class="literal"><span class="pre">reverse_iterator</span></tt> models the same
|
||||
standard iterator access concepts that the <tt class="literal"><span class="pre">Iterator</span></tt>
|
||||
argument models.</p>
|
||||
</div>
|
||||
<div class="section" id="reverse-iterator-operations">
|
||||
<h1><a class="toc-backref" href="#id4" name="reverse-iterator-operations"><tt class="literal"><span class="pre">reverse_iterator</span></tt> operations</a></h1>
|
||||
<h2><a class="toc-backref" href="#id4" name="reverse-iterator-operations"><tt class="literal"><span class="pre">reverse_iterator</span></tt> operations</a></h2>
|
||||
<p><tt class="literal"><span class="pre">reverse_iterator();</span></tt></p>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@ -324,7 +99,7 @@ argument models.</p>
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="literal"><span class="pre">Iterator</span></tt> must be Default Constructible.</td>
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">reverse_iterator</span></tt> with <tt class="literal"><span class="pre">current</span></tt>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">reverse_iterator</span></tt> with <tt class="literal"><span class="pre">m_iterator</span></tt>
|
||||
default constructed.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -335,7 +110,7 @@ default constructed.</td>
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">reverse_iterator</span></tt> with a
|
||||
<tt class="literal"><span class="pre">current</span></tt> constructed from <tt class="literal"><span class="pre">x</span></tt>.</td>
|
||||
<tt class="literal"><span class="pre">m_iterator</span></tt> constructed from <tt class="literal"><span class="pre">x</span></tt>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -356,6 +131,15 @@ reverse_iterator(
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><tt class="literal"><span class="pre">Iterator</span> <span class="pre">base()</span> <span class="pre">const;</span></tt></p>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">m_iterator</span></tt></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><tt class="literal"><span class="pre">reference</span> <span class="pre">operator*()</span> <span class="pre">const;</span></tt></p>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@ -366,15 +150,15 @@ reverse_iterator(
|
||||
</tbody>
|
||||
</table>
|
||||
<pre class="literal-block">
|
||||
Iterator tmp = current;
|
||||
return *--tmp;
|
||||
Iterator tmp = m_iterator;
|
||||
return *..tmp;
|
||||
</pre>
|
||||
<p><tt class="literal"><span class="pre">reverse_iterator&</span> <span class="pre">operator++();</span></tt></p>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Effects:</th><td class="field-body"><tt class="literal"><span class="pre">--current</span></tt></td>
|
||||
<tr class="field"><th class="field-name">Effects:</th><td class="field-body"><tt class="literal"><span class="pre">--m_iterator</span></tt></td>
|
||||
</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>
|
||||
@ -396,7 +180,7 @@ with a <tt class="literal"><span class="pre">current</span></tt> constructed fro
|
||||
</table>
|
||||
</div>
|
||||
<div class="section" id="example">
|
||||
<h1><a class="toc-backref" href="#id5" name="example">Example</a></h1>
|
||||
<h2><a class="toc-backref" href="#id5" name="example">Example</a></h2>
|
||||
<p>The following example prints an array of characters in reverse order
|
||||
using <tt class="literal"><span class="pre">reverse_iterator</span></tt>.</p>
|
||||
<pre class="literal-block">
|
||||
@ -429,11 +213,6 @@ sequence in double-reversed (normal) order: hello world!
|
||||
</pre>
|
||||
</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>
|
||||
</html>
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
Example
|
||||
-------
|
||||
.......
|
||||
|
||||
The following example prints an array of characters in reverse order
|
||||
using ``reverse_iterator``.
|
||||
|
@ -12,22 +12,23 @@
|
||||
reverse_iterator<OtherIterator> const& r
|
||||
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0 // exposition
|
||||
);
|
||||
Iterator base() const;
|
||||
reference operator*() const;
|
||||
reverse_iterator& operator++();
|
||||
private:
|
||||
Iterator current; // exposition
|
||||
Iterator m_iterator; // exposition
|
||||
};
|
||||
|
||||
|
||||
``reverse_iterator`` requirements
|
||||
---------------------------------
|
||||
.................................
|
||||
|
||||
The base ``Iterator`` must be a model of Bidirectional Traversal
|
||||
Iterator and Readable Iterator.
|
||||
|
||||
|
||||
``reverse_iterator`` models
|
||||
---------------------------
|
||||
...........................
|
||||
|
||||
``reverse_iterator`` models Bidirectional Traversal Iterator and
|
||||
Readable Iterator. In addition, ``reverse_iterator`` models the same
|
||||
@ -37,18 +38,18 @@ argument models.
|
||||
|
||||
|
||||
``reverse_iterator`` operations
|
||||
-------------------------------
|
||||
...............................
|
||||
|
||||
``reverse_iterator();``
|
||||
|
||||
:Requires: ``Iterator`` must be Default Constructible.
|
||||
:Returns: An instance of ``reverse_iterator`` with ``current``
|
||||
:Returns: An instance of ``reverse_iterator`` with ``m_iterator``
|
||||
default constructed.
|
||||
|
||||
``explicit reverse_iterator(Iterator x);``
|
||||
|
||||
:Returns: An instance of ``reverse_iterator`` with a
|
||||
``current`` constructed from ``x``.
|
||||
``m_iterator`` constructed from ``x``.
|
||||
|
||||
|
||||
::
|
||||
@ -63,17 +64,24 @@ argument models.
|
||||
:Returns: An instance of ``reverse_iterator`` that is a copy of ``r``.
|
||||
|
||||
|
||||
|
||||
|
||||
``Iterator base() const;``
|
||||
|
||||
:Returns: ``m_iterator``
|
||||
|
||||
|
||||
``reference operator*() const;``
|
||||
|
||||
:Effects:
|
||||
|
||||
::
|
||||
|
||||
Iterator tmp = current;
|
||||
return *--tmp;
|
||||
Iterator tmp = m_iterator;
|
||||
return *..tmp;
|
||||
|
||||
|
||||
``reverse_iterator& operator++();``
|
||||
|
||||
:Effects: ``--current``
|
||||
:Effects: ``--m_iterator``
|
||||
:Returns: ``*this``
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
|
||||
``transform_iterator`` requirements
|
||||
-----------------------------------
|
||||
...................................
|
||||
|
||||
The type ``UnaryFunction`` must be Assignable, Copy Constructible, and
|
||||
the expression ``f(*i)`` must be valid where ``f`` is an object of
|
||||
@ -42,7 +42,7 @@ The type ``Iterator`` must at least model Readable Iterator.
|
||||
|
||||
|
||||
``transform_iterator`` models
|
||||
-----------------------------
|
||||
.............................
|
||||
|
||||
The resulting ``transform_iterator`` models the most refined of the
|
||||
following options that is also modeled by ``Iterator``.
|
||||
@ -64,7 +64,7 @@ The ``value_type`` is ``remove_cv<remove_reference<reference> >::type``.
|
||||
|
||||
|
||||
``transform_iterator`` operations
|
||||
---------------------------------
|
||||
.................................
|
||||
|
||||
``transform_iterator();``
|
||||
|
||||
|
48
example/function_output_iterator_example.cpp
Normal file
48
example/function_output_iterator_example.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
// (C) Copyright Jeremy Siek 2001-2004.
|
||||
// Permission to copy, use, modify, sell and distribute this software
|
||||
// is granted provided this copyright notice appears in all
|
||||
// copies. This software is provided "as is" without express or
|
||||
// implied warranty, and with no claim as to its suitability for any
|
||||
// purpose.
|
||||
|
||||
// Revision History:
|
||||
|
||||
// 27 Feb 2001 Jeremy Siek
|
||||
// Initial checkin.
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/function_output_iterator.hpp>
|
||||
|
||||
struct string_appender
|
||||
{
|
||||
string_appender(std::string& s)
|
||||
: m_str(&s)
|
||||
{}
|
||||
|
||||
void operator()(const std::string& x) const
|
||||
{
|
||||
*m_str += x;
|
||||
}
|
||||
|
||||
std::string* m_str;
|
||||
};
|
||||
|
||||
int main(int, char*[])
|
||||
{
|
||||
std::vector<std::string> x;
|
||||
x.push_back("hello");
|
||||
x.push_back(" ");
|
||||
x.push_back("world");
|
||||
x.push_back("!");
|
||||
|
||||
std::string s = "";
|
||||
std::copy(x.begin(), x.end(),
|
||||
boost::make_function_output_iterator(string_appender(s)));
|
||||
|
||||
std::cout << s << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
59
example/indirect_iterator_example.cpp
Normal file
59
example/indirect_iterator_example.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
#include <boost/iterator/indirect_iterator.hpp>
|
||||
|
||||
int main(int, char*[])
|
||||
{
|
||||
char characters[] = "abcdefg";
|
||||
const int N = sizeof(characters)/sizeof(char) - 1; // -1 since characters has a null char
|
||||
char* pointers_to_chars[N]; // at the end.
|
||||
for (int i = 0; i < N; ++i)
|
||||
pointers_to_chars[i] = &characters[i];
|
||||
|
||||
// Example of using indirect_iterator
|
||||
|
||||
boost::indirect_iterator<char**, char>
|
||||
indirect_first(pointers_to_chars), indirect_last(pointers_to_chars + N);
|
||||
|
||||
std::copy(indirect_first, indirect_last, std::ostream_iterator<char>(std::cout, ","));
|
||||
std::cout << std::endl;
|
||||
|
||||
|
||||
// Example of making mutable and constant indirect iterators
|
||||
|
||||
char mutable_characters[N];
|
||||
char* pointers_to_mutable_chars[N];
|
||||
for (int j = 0; j < N; ++j)
|
||||
pointers_to_mutable_chars[j] = &mutable_characters[j];
|
||||
|
||||
boost::indirect_iterator<char* const*> mutable_indirect_first(pointers_to_mutable_chars),
|
||||
mutable_indirect_last(pointers_to_mutable_chars + N);
|
||||
boost::indirect_iterator<char* const*, char const> const_indirect_first(pointers_to_chars),
|
||||
const_indirect_last(pointers_to_chars + N);
|
||||
|
||||
std::transform(const_indirect_first, const_indirect_last,
|
||||
mutable_indirect_first, std::bind1st(std::plus<char>(), 1));
|
||||
|
||||
std::copy(mutable_indirect_first, mutable_indirect_last,
|
||||
std::ostream_iterator<char>(std::cout, ","));
|
||||
std::cout << std::endl;
|
||||
|
||||
|
||||
// Example of using make_indirect_iterator()
|
||||
|
||||
std::copy(boost::make_indirect_iterator(pointers_to_chars),
|
||||
boost::make_indirect_iterator(pointers_to_chars + N),
|
||||
std::ostream_iterator<char>(std::cout, ","));
|
||||
std::cout << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user