filled out some missing operator--, added a comment about the operations and concepts,

and added some text to the indirect iterator example


[SVN r21629]
This commit is contained in:
Jeremy Siek
2004-01-12 15:53:04 +00:00
parent 0074f50573
commit 4a3fd9984d
18 changed files with 482 additions and 201 deletions

View File

@ -45,12 +45,15 @@ adding an <tt class="literal"><span class="pre">operator*</span></tt> that retur
<div class="contents topic" id="table-of-contents"> <div class="contents topic" id="table-of-contents">
<p class="topic-title"><a name="table-of-contents">Table of Contents</a></p> <p class="topic-title"><a name="table-of-contents">Table of Contents</a></p>
<ul class="simple"> <ul class="simple">
<li><a class="reference" href="#counting-iterator-requirements" id="id1" name="id1"><tt class="literal"><span class="pre">counting_iterator</span></tt> requirements</a></li> <li><a class="reference" href="#counting-iterator-synopsis" id="id1" name="id1"><tt class="literal"><span class="pre">counting_iterator</span></tt> synopsis</a></li>
<li><a class="reference" href="#counting-iterator-models" id="id2" name="id2"><tt class="literal"><span class="pre">counting_iterator</span></tt> models</a></li> <li><a class="reference" href="#counting-iterator-requirements" id="id2" name="id2"><tt class="literal"><span class="pre">counting_iterator</span></tt> requirements</a></li>
<li><a class="reference" href="#counting-iterator-operations" id="id3" name="id3"><tt class="literal"><span class="pre">counting_iterator</span></tt> operations</a></li> <li><a class="reference" href="#counting-iterator-models" id="id3" name="id3"><tt class="literal"><span class="pre">counting_iterator</span></tt> models</a></li>
<li><a class="reference" href="#example" id="id4" name="id4">Example</a></li> <li><a class="reference" href="#counting-iterator-operations" id="id4" name="id4"><tt class="literal"><span class="pre">counting_iterator</span></tt> operations</a></li>
<li><a class="reference" href="#example" id="id5" name="id5">Example</a></li>
</ul> </ul>
</div> </div>
<div class="section" id="counting-iterator-synopsis">
<h1><a class="toc-backref" href="#id1" name="counting-iterator-synopsis"><tt class="literal"><span class="pre">counting_iterator</span></tt> synopsis</a></h1>
<pre class="literal-block"> <pre class="literal-block">
template &lt; template &lt;
class Incrementable class Incrementable
@ -64,8 +67,11 @@ class counting_iterator
counting_iterator(counting_iterator const&amp; rhs); counting_iterator(counting_iterator const&amp; rhs);
explicit counting_iterator(Incrementable x); explicit counting_iterator(Incrementable x);
Incrementable base() const; Incrementable base() const;
reference operator*() const;
counting_iterator&amp; operator++();
counting_iterator&amp; operator--();
private: private:
Incrementable current; // exposition Incrementable m_inc; // exposition
}; };
</pre> </pre>
<dl> <dl>
@ -73,14 +79,15 @@ class counting_iterator
<dd><tt class="literal"><span class="pre">distance_to</span></tt> and a <tt class="literal"><span class="pre">difference_type</span></tt> that avoids overflows in <dd><tt class="literal"><span class="pre">distance_to</span></tt> and a <tt class="literal"><span class="pre">difference_type</span></tt> that avoids overflows in
the cases when the <tt class="literal"><span class="pre">Incrementable</span></tt> type is a numeric type.]</dd> the cases when the <tt class="literal"><span class="pre">Incrementable</span></tt> type is a numeric type.]</dd>
</dl> </dl>
</div>
<div class="section" id="counting-iterator-requirements"> <div class="section" id="counting-iterator-requirements">
<h1><a class="toc-backref" href="#id1" name="counting-iterator-requirements"><tt class="literal"><span class="pre">counting_iterator</span></tt> requirements</a></h1> <h1><a class="toc-backref" href="#id2" name="counting-iterator-requirements"><tt class="literal"><span class="pre">counting_iterator</span></tt> requirements</a></h1>
<p>The <tt class="literal"><span class="pre">Incrementable</span></tt> type must be Default Constructible, Copy <p>The <tt class="literal"><span class="pre">Incrementable</span></tt> type must be Default Constructible, Copy
Constructible, and Assignable. The default distance is Constructible, and Assignable. The default distance is
an implementation defined signed integral type.</p> an implementation defined signed integral type.</p>
</div> </div>
<div class="section" id="counting-iterator-models"> <div class="section" id="counting-iterator-models">
<h1><a class="toc-backref" href="#id2" name="counting-iterator-models"><tt class="literal"><span class="pre">counting_iterator</span></tt> models</a></h1> <h1><a class="toc-backref" href="#id3" name="counting-iterator-models"><tt class="literal"><span class="pre">counting_iterator</span></tt> models</a></h1>
<p><tt class="literal"><span class="pre">counting_iterator</span></tt> models Readable Lvalue Iterator.</p> <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 <p>Furthermore, if you wish to create a counting iterator that is a Forward
Traversal Iterator, then the following expressions must be valid:</p> Traversal Iterator, then the following expressions must be valid:</p>
@ -105,7 +112,10 @@ i &lt; j
</pre> </pre>
</div> </div>
<div class="section" id="counting-iterator-operations"> <div class="section" id="counting-iterator-operations">
<h1><a class="toc-backref" href="#id3" name="counting-iterator-operations"><tt class="literal"><span class="pre">counting_iterator</span></tt> operations</a></h1> <h1><a class="toc-backref" href="#id4" name="counting-iterator-operations"><tt class="literal"><span class="pre">counting_iterator</span></tt> operations</a></h1>
<p>In addition to the operations required by the concepts modeled by
<tt class="literal"><span class="pre">counting_iterator</span></tt>, <tt class="literal"><span class="pre">counting_iterator</span></tt> provides the following
operations.</p>
<p><tt class="literal"><span class="pre">counting_iterator();</span></tt></p> <p><tt class="literal"><span class="pre">counting_iterator();</span></tt></p>
<table class="field-list" frame="void" rules="none"> <table class="field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
@ -129,7 +139,7 @@ i &lt; j
<col class="field-name" /> <col class="field-name" />
<col class="field-body" /> <col class="field-body" />
<tbody valign="top"> <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">counting_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">counting_iterator</span></tt> with <tt class="literal"><span class="pre">m_inc</span></tt>
constructed from <tt class="literal"><span class="pre">x</span></tt>.</td> constructed from <tt class="literal"><span class="pre">x</span></tt>.</td>
</tr> </tr>
</tbody> </tbody>
@ -139,7 +149,7 @@ constructed from <tt class="literal"><span class="pre">x</span></tt>.</td>
<col class="field-name" /> <col class="field-name" />
<col class="field-body" /> <col class="field-body" />
<tbody valign="top"> <tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">current</span></tt></td> <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">m_inc</span></tt></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -148,7 +158,20 @@ constructed from <tt class="literal"><span class="pre">x</span></tt>.</td>
<col class="field-name" /> <col class="field-name" />
<col class="field-body" /> <col class="field-body" />
<tbody valign="top"> <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_inc</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>
</tbody>
</table>
<p><tt class="literal"><span class="pre">counting_iterator&amp;</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">--m_inc</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> </tr>
</tbody> </tbody>
</table> </table>
@ -157,7 +180,7 @@ constructed from <tt class="literal"><span class="pre">x</span></tt>.</td>
<col class="field-name" /> <col class="field-name" />
<col class="field-body" /> <col class="field-body" />
<tbody valign="top"> <tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">current</span></tt></td> <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">m_inc</span></tt></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -176,7 +199,7 @@ with <tt class="literal"><span class="pre">current</span></tt> constructed from
</table> </table>
</div> </div>
<div class="section" id="example"> <div class="section" id="example">
<h1><a class="toc-backref" href="#id4" name="example">Example</a></h1> <h1><a class="toc-backref" href="#id5" name="example">Example</a></h1>
<p>This example fills an array with numbers and a second array with <p>This example fills an array with numbers and a second array with
pointers into the first array, using <tt class="literal"><span class="pre">counting_iterator</span></tt> for both pointers into the first array, using <tt class="literal"><span class="pre">counting_iterator</span></tt> for both
tasks. Finally <tt class="literal"><span class="pre">indirect_iterator</span></tt> is used to print out the numbers tasks. Finally <tt class="literal"><span class="pre">indirect_iterator</span></tt> is used to print out the numbers
@ -211,7 +234,7 @@ indirectly printing out the numbers from 0 to 7
<hr class="footer"/> <hr class="footer"/>
<div class="footer"> <div class="footer">
<a class="reference" href="counting_iterator.rst">View document source</a>. <a class="reference" href="counting_iterator.rst">View document source</a>.
Generated on: 2004-01-12 15:20 UTC. Generated on: 2004-01-12 15: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. 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> </div>
</body> </body>

View File

@ -20,6 +20,9 @@
.. contents:: Table of Contents .. contents:: Table of Contents
``counting_iterator`` synopsis
..............................
.. include:: counting_iterator_ref.rst .. include:: counting_iterator_ref.rst
.. include:: make_counting_iterator.rst .. include:: make_counting_iterator.rst

View File

@ -12,8 +12,11 @@
counting_iterator(counting_iterator const& rhs); counting_iterator(counting_iterator const& rhs);
explicit counting_iterator(Incrementable x); explicit counting_iterator(Incrementable x);
Incrementable base() const; Incrementable base() const;
reference operator*() const;
counting_iterator& operator++();
counting_iterator& operator--();
private: private:
Incrementable current; // exposition Incrementable m_inc; // exposition
}; };
@ -61,6 +64,11 @@ required::
``counting_iterator`` operations ``counting_iterator`` operations
................................ ................................
In addition to the operations required by the concepts modeled by
``counting_iterator``, ``counting_iterator`` provides the following
operations.
``counting_iterator();`` ``counting_iterator();``
:Returns: A default constructed instance of ``counting_iterator``. :Returns: A default constructed instance of ``counting_iterator``.
@ -74,20 +82,27 @@ required::
``explicit counting_iterator(Incrementable x);`` ``explicit counting_iterator(Incrementable x);``
:Returns: An instance of ``counting_iterator`` with ``current`` :Returns: An instance of ``counting_iterator`` with ``m_inc``
constructed from ``x``. constructed from ``x``.
``reference operator*() const;`` ``reference operator*() const;``
:Returns: ``current`` :Returns: ``m_inc``
``counting_iterator& operator++();`` ``counting_iterator& operator++();``
:Effects: ``++current`` :Effects: ``++m_inc``
:Returns: ``*this``
``counting_iterator& operator--();``
:Effects: ``--m_inc``
:Returns: ``*this``
``Incrementable base() const;`` ``Incrementable base() const;``
:Returns: ``current`` :Returns: ``m_inc``

View File

@ -56,82 +56,82 @@ by adapting other iterators.</td>
<div class="contents topic" id="table-of-contents"> <div class="contents topic" id="table-of-contents">
<p class="topic-title"><a name="table-of-contents">Table of Contents</a></p> <p class="topic-title"><a name="table-of-contents">Table of Contents</a></p>
<ul class="simple"> <ul class="simple">
<li><a class="reference" href="#motivation" id="id19" name="id19">Motivation</a></li> <li><a class="reference" href="#motivation" id="id13" name="id13">Motivation</a></li>
<li><a class="reference" href="#impact-on-the-standard" id="id20" name="id20">Impact on the Standard</a></li> <li><a class="reference" href="#impact-on-the-standard" id="id14" name="id14">Impact on the Standard</a></li>
<li><a class="reference" href="#design" id="id21" name="id21">Design</a><ul> <li><a class="reference" href="#design" id="id15" name="id15">Design</a><ul>
<li><a class="reference" href="#iterator-concepts" id="id22" name="id22">Iterator Concepts</a></li> <li><a class="reference" href="#iterator-concepts" id="id16" name="id16">Iterator Concepts</a></li>
<li><a class="reference" href="#interoperability" id="id23" name="id23">Interoperability</a></li> <li><a class="reference" href="#interoperability" id="id17" name="id17">Interoperability</a></li>
<li><a class="reference" href="#iterator-facade" id="id24" name="id24">Iterator Facade</a><ul> <li><a class="reference" href="#iterator-facade" id="id18" name="id18">Iterator Facade</a><ul>
<li><a class="reference" href="#usage" id="id25" name="id25">Usage</a></li> <li><a class="reference" href="#usage" id="id19" name="id19">Usage</a></li>
<li><a class="reference" href="#iterator-core-access" id="id26" name="id26">Iterator Core Access</a></li> <li><a class="reference" href="#iterator-core-access" id="id20" name="id20">Iterator Core Access</a></li>
<li><a class="reference" href="#operator" id="id27" name="id27"><tt class="literal"><span class="pre">operator[]</span></tt></a></li> <li><a class="reference" href="#operator" id="id21" name="id21"><tt class="literal"><span class="pre">operator[]</span></tt></a></li>
<li><a class="reference" href="#id6" id="id28" name="id28"><tt class="literal"><span class="pre">operator-&gt;</span></tt></a></li> <li><a class="reference" href="#id6" id="id22" name="id22"><tt class="literal"><span class="pre">operator-&gt;</span></tt></a></li>
</ul> </ul>
</li> </li>
<li><a class="reference" href="#iterator-adaptor" id="id29" name="id29">Iterator Adaptor</a></li> <li><a class="reference" href="#iterator-adaptor" id="id23" name="id23">Iterator Adaptor</a></li>
<li><a class="reference" href="#specialized-adaptors" id="id30" name="id30">Specialized Adaptors</a></li> <li><a class="reference" href="#specialized-adaptors" id="id24" name="id24">Specialized Adaptors</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference" href="#proposed-text" id="id31" name="id31">Proposed Text</a><ul> <li><a class="reference" href="#proposed-text" id="id25" name="id25">Proposed Text</a><ul>
<li><a class="reference" href="#header-iterator-helper-synopsis-lib-iterator-helper-synopsis" id="id32" name="id32">Header <tt class="literal"><span class="pre">&lt;iterator_helper&gt;</span></tt> synopsis [lib.iterator.helper.synopsis]</a></li> <li><a class="reference" href="#header-iterator-helper-synopsis-lib-iterator-helper-synopsis" id="id26" name="id26">Header <tt class="literal"><span class="pre">&lt;iterator_helper&gt;</span></tt> synopsis [lib.iterator.helper.synopsis]</a></li>
<li><a class="reference" href="#iterator-facade-lib-iterator-facade" id="id33" name="id33">Iterator facade [lib.iterator.facade]</a><ul> <li><a class="reference" href="#iterator-facade-lib-iterator-facade" id="id27" name="id27">Iterator facade [lib.iterator.facade]</a><ul>
<li><a class="reference" href="#iterator-facade-usage" id="id34" name="id34"><tt class="literal"><span class="pre">iterator_facade</span></tt> usage</a><ul> <li><a class="reference" href="#iterator-facade-usage" id="id28" name="id28"><tt class="literal"><span class="pre">iterator_facade</span></tt> usage</a><ul>
<li><a class="reference" href="#iterator-facade-core-operations" id="id35" name="id35"><tt class="literal"><span class="pre">iterator_facade</span></tt> Core Operations</a></li> <li><a class="reference" href="#iterator-facade-core-operations" id="id29" name="id29"><tt class="literal"><span class="pre">iterator_facade</span></tt> Core Operations</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference" href="#iterator-facade-iterator-category" id="id36" name="id36"><tt class="literal"><span class="pre">iterator_facade</span></tt> iterator category</a></li> <li><a class="reference" href="#iterator-facade-iterator-category" id="id30" name="id30"><tt class="literal"><span class="pre">iterator_facade</span></tt> iterator category</a></li>
<li><a class="reference" href="#iterator-facade-operations" id="id37" name="id37"><tt class="literal"><span class="pre">iterator_facade</span></tt> operations</a></li> <li><a class="reference" href="#iterator-facade-operations" id="id31" name="id31"><tt class="literal"><span class="pre">iterator_facade</span></tt> operations</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference" href="#iterator-adaptor-lib-iterator-adaptor" id="id38" name="id38">Iterator adaptor [lib.iterator.adaptor]</a><ul> <li><a class="reference" href="#iterator-adaptor-lib-iterator-adaptor" id="id32" name="id32">Iterator adaptor [lib.iterator.adaptor]</a><ul>
<li><a class="reference" href="#iterator-adaptor-base-class-parameters" id="id39" name="id39"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> base class parameters</a></li> <li><a class="reference" href="#iterator-adaptor-base-class-parameters" id="id33" name="id33"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> base class parameters</a></li>
<li><a class="reference" href="#iterator-adaptor-usage" id="id40" name="id40"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> usage</a></li> <li><a class="reference" href="#iterator-adaptor-usage" id="id34" name="id34"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> usage</a></li>
<li><a class="reference" href="#iterator-adaptor-public-operations" id="id41" name="id41"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> public operations</a></li> <li><a class="reference" href="#iterator-adaptor-public-operations" id="id35" name="id35"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> public operations</a></li>
<li><a class="reference" href="#iterator-adaptor-protected-member-functions" id="id42" name="id42"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> protected member functions</a></li> <li><a class="reference" href="#iterator-adaptor-protected-member-functions" id="id36" name="id36"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> protected member functions</a></li>
<li><a class="reference" href="#iterator-adaptor-private-member-functions" id="id43" name="id43"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> private member functions</a></li> <li><a class="reference" href="#iterator-adaptor-private-member-functions" id="id37" name="id37"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> private member functions</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference" href="#specialized-adaptors-lib-iterator-special-adaptors" id="id44" name="id44">Specialized adaptors [lib.iterator.special.adaptors]</a><ul> <li><a class="reference" href="#specialized-adaptors-lib-iterator-special-adaptors" id="id38" name="id38">Specialized adaptors [lib.iterator.special.adaptors]</a><ul>
<li><a class="reference" href="#indirect-iterator" id="id45" name="id45">Indirect iterator</a><ul> <li><a class="reference" href="#indirect-iterator" id="id39" name="id39">Indirect iterator</a><ul>
<li><a class="reference" href="#class-template-indirect-iterator" id="id46" name="id46">Class template <tt class="literal"><span class="pre">indirect_iterator</span></tt></a></li> <li><a class="reference" href="#class-template-indirect-iterator" id="id40" name="id40">Class template <tt class="literal"><span class="pre">indirect_iterator</span></tt></a></li>
<li><a class="reference" href="#indirect-iterator-requirements" id="id47" name="id47"><tt class="literal"><span class="pre">indirect_iterator</span></tt> requirements</a></li> <li><a class="reference" href="#indirect-iterator-requirements" id="id41" name="id41"><tt class="literal"><span class="pre">indirect_iterator</span></tt> requirements</a></li>
<li><a class="reference" href="#indirect-iterator-models" id="id48" name="id48"><tt class="literal"><span class="pre">indirect_iterator</span></tt> models</a></li> <li><a class="reference" href="#indirect-iterator-models" id="id42" name="id42"><tt class="literal"><span class="pre">indirect_iterator</span></tt> models</a></li>
<li><a class="reference" href="#indirect-iterator-operations" id="id49" name="id49"><tt class="literal"><span class="pre">indirect_iterator</span></tt> operations</a></li> <li><a class="reference" href="#indirect-iterator-operations" id="id43" name="id43"><tt class="literal"><span class="pre">indirect_iterator</span></tt> operations</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference" href="#reverse-iterator" id="id50" name="id50">Reverse iterator</a><ul> <li><a class="reference" href="#reverse-iterator" id="id44" name="id44">Reverse iterator</a><ul>
<li><a class="reference" href="#class-template-reverse-iterator" id="id51" name="id51">Class template <tt class="literal"><span class="pre">reverse_iterator</span></tt></a></li> <li><a class="reference" href="#class-template-reverse-iterator" id="id45" name="id45">Class template <tt class="literal"><span class="pre">reverse_iterator</span></tt></a></li>
<li><a class="reference" href="#reverse-iterator-requirements" id="id52" name="id52"><tt class="literal"><span class="pre">reverse_iterator</span></tt> requirements</a></li> <li><a class="reference" href="#reverse-iterator-requirements" id="id46" name="id46"><tt class="literal"><span class="pre">reverse_iterator</span></tt> requirements</a></li>
<li><a class="reference" href="#reverse-iterator-models" id="id53" name="id53"><tt class="literal"><span class="pre">reverse_iterator</span></tt> models</a></li> <li><a class="reference" href="#reverse-iterator-models" id="id47" name="id47"><tt class="literal"><span class="pre">reverse_iterator</span></tt> models</a></li>
<li><a class="reference" href="#reverse-iterator-operations" id="id54" name="id54"><tt class="literal"><span class="pre">reverse_iterator</span></tt> operations</a></li> <li><a class="reference" href="#reverse-iterator-operations" id="id48" name="id48"><tt class="literal"><span class="pre">reverse_iterator</span></tt> operations</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference" href="#transform-iterator" id="id55" name="id55">Transform iterator</a><ul> <li><a class="reference" href="#transform-iterator" id="id49" name="id49">Transform iterator</a><ul>
<li><a class="reference" href="#class-template-transform-iterator" id="id56" name="id56">Class template <tt class="literal"><span class="pre">transform_iterator</span></tt></a></li> <li><a class="reference" href="#class-template-transform-iterator" id="id50" name="id50">Class template <tt class="literal"><span class="pre">transform_iterator</span></tt></a></li>
<li><a class="reference" href="#transform-iterator-requirements" id="id57" name="id57"><tt class="literal"><span class="pre">transform_iterator</span></tt> requirements</a></li> <li><a class="reference" href="#transform-iterator-requirements" id="id51" name="id51"><tt class="literal"><span class="pre">transform_iterator</span></tt> requirements</a></li>
<li><a class="reference" href="#transform-iterator-models" id="id58" name="id58"><tt class="literal"><span class="pre">transform_iterator</span></tt> models</a></li> <li><a class="reference" href="#transform-iterator-models" id="id52" name="id52"><tt class="literal"><span class="pre">transform_iterator</span></tt> models</a></li>
<li><a class="reference" href="#transform-iterator-operations" id="id59" name="id59"><tt class="literal"><span class="pre">transform_iterator</span></tt> operations</a></li> <li><a class="reference" href="#transform-iterator-operations" id="id53" name="id53"><tt class="literal"><span class="pre">transform_iterator</span></tt> operations</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference" href="#filter-iterator" id="id60" name="id60">Filter iterator</a><ul> <li><a class="reference" href="#filter-iterator" id="id54" name="id54">Filter iterator</a><ul>
<li><a class="reference" href="#class-template-filter-iterator" id="id61" name="id61">Class template <tt class="literal"><span class="pre">filter_iterator</span></tt></a></li> <li><a class="reference" href="#class-template-filter-iterator" id="id55" name="id55">Class template <tt class="literal"><span class="pre">filter_iterator</span></tt></a></li>
<li><a class="reference" href="#filter-iterator-requirements" id="id62" name="id62"><tt class="literal"><span class="pre">filter_iterator</span></tt> requirements</a></li> <li><a class="reference" href="#filter-iterator-requirements" id="id56" name="id56"><tt class="literal"><span class="pre">filter_iterator</span></tt> requirements</a></li>
<li><a class="reference" href="#filter-iterator-models" id="id63" name="id63"><tt class="literal"><span class="pre">filter_iterator</span></tt> models</a></li> <li><a class="reference" href="#filter-iterator-models" id="id57" name="id57"><tt class="literal"><span class="pre">filter_iterator</span></tt> models</a></li>
<li><a class="reference" href="#filter-iterator-operations" id="id64" name="id64"><tt class="literal"><span class="pre">filter_iterator</span></tt> operations</a></li> <li><a class="reference" href="#filter-iterator-operations" id="id58" name="id58"><tt class="literal"><span class="pre">filter_iterator</span></tt> operations</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference" href="#counting-iterator" id="id65" name="id65">Counting iterator</a><ul> <li><a class="reference" href="#counting-iterator" id="id59" name="id59">Counting iterator</a><ul>
<li><a class="reference" href="#class-template-counting-iterator" id="id66" name="id66">Class template <tt class="literal"><span class="pre">counting_iterator</span></tt></a></li> <li><a class="reference" href="#class-template-counting-iterator" id="id60" name="id60">Class template <tt class="literal"><span class="pre">counting_iterator</span></tt></a></li>
<li><a class="reference" href="#counting-iterator-requirements" id="id67" name="id67"><tt class="literal"><span class="pre">counting_iterator</span></tt> requirements</a></li> <li><a class="reference" href="#counting-iterator-requirements" id="id61" name="id61"><tt class="literal"><span class="pre">counting_iterator</span></tt> requirements</a></li>
<li><a class="reference" href="#counting-iterator-models" id="id68" name="id68"><tt class="literal"><span class="pre">counting_iterator</span></tt> models</a></li> <li><a class="reference" href="#counting-iterator-models" id="id62" name="id62"><tt class="literal"><span class="pre">counting_iterator</span></tt> models</a></li>
<li><a class="reference" href="#counting-iterator-operations" id="id69" name="id69"><tt class="literal"><span class="pre">counting_iterator</span></tt> operations</a></li> <li><a class="reference" href="#counting-iterator-operations" id="id63" name="id63"><tt class="literal"><span class="pre">counting_iterator</span></tt> operations</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference" href="#function-output-iterator" id="id70" name="id70">Function output iterator</a><ul> <li><a class="reference" href="#function-output-iterator" id="id64" name="id64">Function output iterator</a><ul>
<li><a class="reference" href="#class-template-function-output-iterator" id="id71" name="id71">Class template <tt class="literal"><span class="pre">function_output_iterator</span></tt></a></li> <li><a class="reference" href="#class-template-function-output-iterator" id="id65" name="id65">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="id72" name="id72"><tt class="literal"><span class="pre">function_output_iterator</span></tt> requirements</a></li> <li><a class="reference" href="#function-output-iterator-requirements" id="id66" name="id66"><tt class="literal"><span class="pre">function_output_iterator</span></tt> requirements</a></li>
<li><a class="reference" href="#function-output-iterator-operations" id="id73" name="id73"><tt class="literal"><span class="pre">function_output_iterator</span></tt> operations</a></li> <li><a class="reference" href="#function-output-iterator-operations" id="id67" name="id67"><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="id74" name="id74"><tt class="literal"><span class="pre">function_output_iterator::output_proxy</span></tt> operations</a></li> <li><a class="reference" href="#function-output-iterator-output-proxy-operations" id="id68" name="id68"><tt class="literal"><span class="pre">function_output_iterator::output_proxy</span></tt> operations</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -141,7 +141,7 @@ by adapting other iterators.</td>
</ul> </ul>
</div> </div>
<div class="section" id="motivation"> <div class="section" id="motivation">
<h1><a class="toc-backref" href="#id19" name="motivation">Motivation</a></h1> <h1><a class="toc-backref" href="#id13" name="motivation">Motivation</a></h1>
<p>Iterators play an important role in modern C++ programming. The <p>Iterators play an important role in modern C++ programming. The
iterator is the central abstraction of the algorithms of the Standard iterator is the central abstraction of the algorithms of the Standard
Library, allowing algorithms to be re-used in in a wide variety of Library, allowing algorithms to be re-used in in a wide variety of
@ -226,15 +226,15 @@ applies some user-specified function during the dereference of the
iterator.</p> iterator.</p>
</div> </div>
<div class="section" id="impact-on-the-standard"> <div class="section" id="impact-on-the-standard">
<h1><a class="toc-backref" href="#id20" name="impact-on-the-standard">Impact on the Standard</a></h1> <h1><a class="toc-backref" href="#id14" name="impact-on-the-standard">Impact on the Standard</a></h1>
<p>This proposal is purely an addition to the C++ standard library. <p>This proposal is purely an addition to the C++ standard library.
However, note that this proposal relies on the proposal for New However, note that this proposal relies on the proposal for New
Iterator Concepts.</p> Iterator Concepts.</p>
</div> </div>
<div class="section" id="design"> <div class="section" id="design">
<h1><a class="toc-backref" href="#id21" name="design">Design</a></h1> <h1><a class="toc-backref" href="#id15" name="design">Design</a></h1>
<div class="section" id="iterator-concepts"> <div class="section" id="iterator-concepts">
<h2><a class="toc-backref" href="#id22" name="iterator-concepts">Iterator Concepts</a></h2> <h2><a class="toc-backref" href="#id16" name="iterator-concepts">Iterator Concepts</a></h2>
<p>This proposal is formulated in terms of the new <tt class="literal"><span class="pre">iterator</span> <span class="pre">concepts</span></tt> <p>This proposal is formulated in terms of the new <tt class="literal"><span class="pre">iterator</span> <span class="pre">concepts</span></tt>
as proposed in <a class="reference" href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/papers/2003/n1550.html">n1550</a>, since user-defined and especially adapted as proposed in <a class="reference" href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/papers/2003/n1550.html">n1550</a>, since user-defined and especially adapted
iterators suffer from the well known categorization problems that are iterators suffer from the well known categorization problems that are
@ -244,7 +244,7 @@ is a direct mapping between new and old categories. This proposal
could be reformulated using this mapping if <a class="reference" href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/papers/2003/n1550.html">n1550</a> was not accepted.</p> could be reformulated using this mapping if <a class="reference" href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/papers/2003/n1550.html">n1550</a> was not accepted.</p>
</div> </div>
<div class="section" id="interoperability"> <div class="section" id="interoperability">
<h2><a class="toc-backref" href="#id23" name="interoperability">Interoperability</a></h2> <h2><a class="toc-backref" href="#id17" name="interoperability">Interoperability</a></h2>
<p>The question of iterator interoperability is poorly addressed in the <p>The question of iterator interoperability is poorly addressed in the
current standard. There are currently two defect reports that are current standard. There are currently two defect reports that are
concerned with interoperability issues.</p> concerned with interoperability issues.</p>
@ -264,7 +264,7 @@ fixes the issues raised in 280. It provides the desired
interoperability without introducing unwanted overloads.</p> interoperability without introducing unwanted overloads.</p>
</div> </div>
<div class="section" id="iterator-facade"> <div class="section" id="iterator-facade">
<h2><a class="toc-backref" href="#id24" name="iterator-facade">Iterator Facade</a></h2> <h2><a class="toc-backref" href="#id18" name="iterator-facade">Iterator Facade</a></h2>
<!-- Version 1.1 of this ReStructuredText document corresponds to <!-- Version 1.1 of this ReStructuredText document corresponds to
n1530_, the paper accepted by the LWG for TR1. --> n1530_, the paper accepted by the LWG for TR1. -->
<!-- Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All <!-- Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All
@ -307,7 +307,7 @@ impossible.</li>
</ol> </ol>
</blockquote> </blockquote>
<div class="section" id="usage"> <div class="section" id="usage">
<h3><a class="toc-backref" href="#id25" name="usage">Usage</a></h3> <h3><a class="toc-backref" href="#id19" name="usage">Usage</a></h3>
<p>The user of <tt class="literal"><span class="pre">iterator_facade</span></tt> derives his iterator class from a <p>The user of <tt class="literal"><span class="pre">iterator_facade</span></tt> derives his iterator class from a
specialization of <tt class="literal"><span class="pre">iterator_facade</span></tt> and passes the derived specialization of <tt class="literal"><span class="pre">iterator_facade</span></tt> and passes the derived
iterator class as <tt class="literal"><span class="pre">iterator_facade</span></tt>'s first template parameter. iterator class as <tt class="literal"><span class="pre">iterator_facade</span></tt>'s first template parameter.
@ -371,7 +371,7 @@ Iterator or a more-refined iterator concept, a default constructor is
required.</p> required.</p>
</div> </div>
<div class="section" id="iterator-core-access"> <div class="section" id="iterator-core-access">
<h3><a class="toc-backref" href="#id26" name="iterator-core-access">Iterator Core Access</a></h3> <h3><a class="toc-backref" href="#id20" name="iterator-core-access">Iterator Core Access</a></h3>
<p><tt class="literal"><span class="pre">iterator_facade</span></tt> and the operator implementations need to be able <p><tt class="literal"><span class="pre">iterator_facade</span></tt> and the operator implementations need to be able
to access the core member functions in the derived class. Making the to access the core member functions in the derived class. Making the
core member functions public would expose an implementation detail to core member functions public would expose an implementation detail to
@ -405,7 +405,7 @@ open a safety loophole, as every core member function preserves the
invariants of the iterator.</p> invariants of the iterator.</p>
</div> </div>
<div class="section" id="operator"> <div class="section" id="operator">
<h3><a class="toc-backref" href="#id27" name="operator"><tt class="literal"><span class="pre">operator[]</span></tt></a></h3> <h3><a class="toc-backref" href="#id21" name="operator"><tt class="literal"><span class="pre">operator[]</span></tt></a></h3>
<p>The indexing operator for a generalized iterator presents special <p>The indexing operator for a generalized iterator presents special
challenges. A random access iterator's <tt class="literal"><span class="pre">operator[]</span></tt> is only challenges. A random access iterator's <tt class="literal"><span class="pre">operator[]</span></tt> is only
required to return something convertible to its <tt class="literal"><span class="pre">value_type</span></tt>. required to return something convertible to its <tt class="literal"><span class="pre">value_type</span></tt>.
@ -428,7 +428,7 @@ class; it will hide the one supplied by <tt class="literal"><span class="pre">it
clients of her iterator.</p> clients of her iterator.</p>
<a class="target" id="operator-arrow" name="operator-arrow"></a></div> <a class="target" id="operator-arrow" name="operator-arrow"></a></div>
<div class="section" id="id6"> <div class="section" id="id6">
<h3><a class="toc-backref" href="#id28" name="id6"><tt class="literal"><span class="pre">operator-&gt;</span></tt></a></h3> <h3><a class="toc-backref" href="#id22" name="id6"><tt class="literal"><span class="pre">operator-&gt;</span></tt></a></h3>
<p>The <tt class="literal"><span class="pre">reference</span></tt> type of a readable iterator (and today's input <p>The <tt class="literal"><span class="pre">reference</span></tt> type of a readable iterator (and today's input
iterator) need not in fact be a reference, so long as it is iterator) need not in fact be a reference, so long as it is
convertible to the iterator's <tt class="literal"><span class="pre">value_type</span></tt>. When the <tt class="literal"><span class="pre">value_type</span></tt> convertible to the iterator's <tt class="literal"><span class="pre">value_type</span></tt>. When the <tt class="literal"><span class="pre">value_type</span></tt>
@ -450,7 +450,7 @@ Patterns, C++ Report, February 1995, pp. 24-27.</td></tr>
</div> </div>
</div> </div>
<div class="section" id="iterator-adaptor"> <div class="section" id="iterator-adaptor">
<h2><a class="toc-backref" href="#id29" name="iterator-adaptor">Iterator Adaptor</a></h2> <h2><a class="toc-backref" href="#id23" name="iterator-adaptor">Iterator Adaptor</a></h2>
<!-- Version 1.2 of this ReStructuredText document corresponds to <!-- Version 1.2 of this ReStructuredText document corresponds to
n1530_, the paper accepted by the LWG for TR1. --> n1530_, the paper accepted by the LWG for TR1. -->
<!-- Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All <!-- Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All
@ -491,7 +491,7 @@ template parameter may not always be identical to the iterator's
that assumption.</p> that assumption.</p>
</div> </div>
<div class="section" id="specialized-adaptors"> <div class="section" id="specialized-adaptors">
<h2><a class="toc-backref" href="#id30" name="specialized-adaptors">Specialized Adaptors</a></h2> <h2><a class="toc-backref" href="#id24" name="specialized-adaptors">Specialized Adaptors</a></h2>
<p>This proposal also contains several examples of specialized adaptors <p>This proposal also contains several examples of specialized adaptors
which were easily implemented using <tt class="literal"><span class="pre">iterator_adaptor</span></tt>:</p> which were easily implemented using <tt class="literal"><span class="pre">iterator_adaptor</span></tt>:</p>
<ul class="simple"> <ul class="simple">
@ -528,9 +528,9 @@ Standard compliant iterators).</p>
</div> </div>
</div> </div>
<div class="section" id="proposed-text"> <div class="section" id="proposed-text">
<h1><a class="toc-backref" href="#id31" name="proposed-text">Proposed Text</a></h1> <h1><a class="toc-backref" href="#id25" name="proposed-text">Proposed Text</a></h1>
<div class="section" id="header-iterator-helper-synopsis-lib-iterator-helper-synopsis"> <div class="section" id="header-iterator-helper-synopsis-lib-iterator-helper-synopsis">
<h2><a class="toc-backref" href="#id32" name="header-iterator-helper-synopsis-lib-iterator-helper-synopsis">Header <tt class="literal"><span class="pre">&lt;iterator_helper&gt;</span></tt> synopsis [lib.iterator.helper.synopsis]</a></h2> <h2><a class="toc-backref" href="#id26" name="header-iterator-helper-synopsis-lib-iterator-helper-synopsis">Header <tt class="literal"><span class="pre">&lt;iterator_helper&gt;</span></tt> synopsis [lib.iterator.helper.synopsis]</a></h2>
<pre class="literal-block"> <pre class="literal-block">
struct use_default; struct use_default;
@ -590,7 +590,7 @@ class function_output_iterator;
</pre> </pre>
</div> </div>
<div class="section" id="iterator-facade-lib-iterator-facade"> <div class="section" id="iterator-facade-lib-iterator-facade">
<h2><a class="toc-backref" href="#id33" name="iterator-facade-lib-iterator-facade">Iterator facade [lib.iterator.facade]</a></h2> <h2><a class="toc-backref" href="#id27" name="iterator-facade-lib-iterator-facade">Iterator facade [lib.iterator.facade]</a></h2>
<p><tt class="literal"><span class="pre">iterator_facade</span></tt> is a base class template that implements the <p><tt class="literal"><span class="pre">iterator_facade</span></tt> is a base class template that implements the
interface of standard iterators in terms of a few core functions interface of standard iterators in terms of a few core functions
and associated types, to be supplied by a derived iterator class.</p> and associated types, to be supplied by a derived iterator class.</p>
@ -705,7 +705,7 @@ struct enable_if_interoperable
{}; {};
</pre> </pre>
<div class="section" id="iterator-facade-usage"> <div class="section" id="iterator-facade-usage">
<h3><a class="toc-backref" href="#id34" name="iterator-facade-usage"><tt class="literal"><span class="pre">iterator_facade</span></tt> usage</a></h3> <h3><a class="toc-backref" href="#id28" name="iterator-facade-usage"><tt class="literal"><span class="pre">iterator_facade</span></tt> usage</a></h3>
<p>The following table describes the typical valid expressions on <p>The following table describes the typical valid expressions on
<tt class="literal"><span class="pre">iterator_facade</span></tt>'s <tt class="literal"><span class="pre">Derived</span></tt> parameter, depending on the <tt class="literal"><span class="pre">iterator_facade</span></tt>'s <tt class="literal"><span class="pre">Derived</span></tt> parameter, depending on the
iterator concept(s) it will model. The operations in the first iterator concept(s) it will model. The operations in the first
@ -718,7 +718,7 @@ object of a single pass iterator type interoperable with <tt class="literal"><sp
is a constant object of a random access traversal iterator type is a constant object of a random access traversal iterator type
interoperable with <tt class="literal"><span class="pre">X</span></tt>.</p> interoperable with <tt class="literal"><span class="pre">X</span></tt>.</p>
<a class="target" id="core-operations" name="core-operations"></a><div class="section" id="iterator-facade-core-operations"> <a class="target" id="core-operations" name="core-operations"></a><div class="section" id="iterator-facade-core-operations">
<h4><a class="toc-backref" href="#id35" name="iterator-facade-core-operations"><tt class="literal"><span class="pre">iterator_facade</span></tt> Core Operations</a></h4> <h4><a class="toc-backref" href="#id29" name="iterator-facade-core-operations"><tt class="literal"><span class="pre">iterator_facade</span></tt> Core Operations</a></h4>
<table class="table" frame="border" rules="all"> <table class="table" frame="border" rules="all">
<colgroup> <colgroup>
<col width="19%" /> <col width="19%" />
@ -786,7 +786,7 @@ Iterator</td>
<a class="target" id="facade-iterator-category" name="facade-iterator-category"></a></div> <a class="target" id="facade-iterator-category" name="facade-iterator-category"></a></div>
</div> </div>
<div class="section" id="iterator-facade-iterator-category"> <div class="section" id="iterator-facade-iterator-category">
<h3><a class="toc-backref" href="#id36" name="iterator-facade-iterator-category"><tt class="literal"><span class="pre">iterator_facade</span></tt> iterator category</a></h3> <h3><a class="toc-backref" href="#id30" name="iterator-facade-iterator-category"><tt class="literal"><span class="pre">iterator_facade</span></tt> iterator category</a></h3>
<p>The <tt class="literal"><span class="pre">iterator_category</span></tt> member of <tt class="literal"><span class="pre">iterator_facade&lt;X,V,R,C,D&gt;</span></tt> <p>The <tt class="literal"><span class="pre">iterator_category</span></tt> member of <tt class="literal"><span class="pre">iterator_facade&lt;X,V,R,C,D&gt;</span></tt>
is a type which satisfies the following conditions:</p> is a type which satisfies the following conditions:</p>
<blockquote> <blockquote>
@ -839,7 +839,7 @@ convertible, and not to any more-derived traversal tag type.</p>
</blockquote> </blockquote>
</div> </div>
<div class="section" id="iterator-facade-operations"> <div class="section" id="iterator-facade-operations">
<h3><a class="toc-backref" href="#id37" name="iterator-facade-operations"><tt class="literal"><span class="pre">iterator_facade</span></tt> operations</a></h3> <h3><a class="toc-backref" href="#id31" name="iterator-facade-operations"><tt class="literal"><span class="pre">iterator_facade</span></tt> operations</a></h3>
<p>The operations in this section are described in terms of operations on <p>The operations in this section are described in terms of operations on
the core interface of <tt class="literal"><span class="pre">Derived</span></tt> which may be inaccessible the core interface of <tt class="literal"><span class="pre">Derived</span></tt> which may be inaccessible
(i.e. private). The implementation should access these operations (i.e. private). The implementation should access these operations
@ -981,7 +981,7 @@ return tmp -= n;
</div> </div>
</div> </div>
<div class="section" id="iterator-adaptor-lib-iterator-adaptor"> <div class="section" id="iterator-adaptor-lib-iterator-adaptor">
<h2><a class="toc-backref" href="#id38" name="iterator-adaptor-lib-iterator-adaptor">Iterator adaptor [lib.iterator.adaptor]</a></h2> <h2><a class="toc-backref" href="#id32" name="iterator-adaptor-lib-iterator-adaptor">Iterator adaptor [lib.iterator.adaptor]</a></h2>
<!-- Version 1.1 of this ReStructuredText document corresponds to <!-- Version 1.1 of this ReStructuredText document corresponds to
n1530_, the paper accepted by the LWG. --> n1530_, the paper accepted by the LWG. -->
<!-- Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All <!-- Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All
@ -1043,7 +1043,7 @@ class iterator_adaptor
}; };
</pre> </pre>
<a class="target" id="base-parameters" name="base-parameters"></a><div class="section" id="iterator-adaptor-base-class-parameters"> <a class="target" id="base-parameters" name="base-parameters"></a><div class="section" id="iterator-adaptor-base-class-parameters">
<h3><a class="toc-backref" href="#id39" name="iterator-adaptor-base-class-parameters"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> base class parameters</a></h3> <h3><a class="toc-backref" href="#id33" name="iterator-adaptor-base-class-parameters"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> base class parameters</a></h3>
<p>The <em>V</em>, <em>C</em>, <em>R</em>, and <em>D</em> parameters of the <tt class="literal"><span class="pre">iterator_facade</span></tt> <p>The <em>V</em>, <em>C</em>, <em>R</em>, and <em>D</em> parameters of the <tt class="literal"><span class="pre">iterator_facade</span></tt>
used as a base class in the summary of <tt class="literal"><span class="pre">iterator_adaptor</span></tt> used as a base class in the summary of <tt class="literal"><span class="pre">iterator_adaptor</span></tt>
above are defined as follows:</p> above are defined as follows:</p>
@ -1073,28 +1073,19 @@ above are defined as follows:</p>
</pre> </pre>
</div> </div>
<div class="section" id="iterator-adaptor-usage"> <div class="section" id="iterator-adaptor-usage">
<h3><a class="toc-backref" href="#id40" name="iterator-adaptor-usage"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> usage</a></h3> <h3><a class="toc-backref" href="#id34" name="iterator-adaptor-usage"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> usage</a></h3>
<p>The <tt class="literal"><span class="pre">Derived</span></tt> template parameter must be a publicly derived from <p>The <tt class="literal"><span class="pre">Derived</span></tt> template parameter must be a publicly derived from
<tt class="literal"><span class="pre">iterator_adaptor</span></tt>. In order for <tt class="literal"><span class="pre">Derived</span></tt> to model the <tt class="literal"><span class="pre">iterator_adaptor</span></tt>. In order for <tt class="literal"><span class="pre">Derived</span></tt> to model the
iterator concepts corresponding to iterator concepts corresponding to
<tt class="literal"><span class="pre">iterator_traits&lt;Derived&gt;::iterator_category</span></tt>, the expressions <tt class="literal"><span class="pre">iterator_traits&lt;Derived&gt;::iterator_category</span></tt>, the expressions
involving <tt class="literal"><span class="pre">m_iterator</span></tt> in the specifications of those private involving <tt class="literal"><span class="pre">m_iterator</span></tt> in the specifications of those private
member functions of <tt class="literal"><span class="pre">iterator_adaptor</span></tt> that may be called by member functions of <tt class="literal"><span class="pre">iterator_adaptor</span></tt> that may be called by
<tt class="literal"><span class="pre">iterator_facade&lt;Derived,</span> <span class="pre">``</span> <span class="pre">*V*</span></tt>, `` <a href="#id13" name="id14"><span class="problematic" id="id14">*</span></a>C*``, `` <a href="#id15" name="id16"><span class="problematic" id="id16">*</span></a>R*``, `` <tt class="literal"><span class="pre">iterator_facade&lt;Derived,</span> <span class="pre">V,</span> <span class="pre">C,</span> <span class="pre">R,</span> <span class="pre">D&gt;</span></tt>
<a href="#id17" name="id18"><span class="problematic" id="id18">*</span></a>D*``&gt;`` in evaluating any valid expression involving <tt class="literal"><span class="pre">Derived</span></tt> in evaluating any valid expression involving <tt class="literal"><span class="pre">Derived</span></tt>
in those concepts' requirements.</p> in those concepts' requirements.</p>
<div class="system-message" id="id13">
<p class="system-message-title">System Message: <a name="id13">WARNING/2</a> (<tt>facade-and-adaptor.rst</tt>, line 989); <em><a href="#id14">backlink</a></em></p>
Inline emphasis start-string without end-string.</div>
<div class="system-message" id="id15">
<p class="system-message-title">System Message: <a name="id15">WARNING/2</a> (<tt>facade-and-adaptor.rst</tt>, line 989); <em><a href="#id16">backlink</a></em></p>
Inline emphasis start-string without end-string.</div>
<div class="system-message" id="id17">
<p class="system-message-title">System Message: <a name="id17">WARNING/2</a> (<tt>facade-and-adaptor.rst</tt>, line 989); <em><a href="#id18">backlink</a></em></p>
Inline emphasis start-string without end-string.</div>
</div> </div>
<div class="section" id="iterator-adaptor-public-operations"> <div class="section" id="iterator-adaptor-public-operations">
<h3><a class="toc-backref" href="#id41" name="iterator-adaptor-public-operations"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> public operations</a></h3> <h3><a class="toc-backref" href="#id35" name="iterator-adaptor-public-operations"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> public operations</a></h3>
<p><tt class="literal"><span class="pre">iterator_adaptor();</span></tt></p> <p><tt class="literal"><span class="pre">iterator_adaptor();</span></tt></p>
<table class="field-list" frame="void" rules="none"> <table class="field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
@ -1128,7 +1119,7 @@ Inline emphasis start-string without end-string.</div>
</table> </table>
</div> </div>
<div class="section" id="iterator-adaptor-protected-member-functions"> <div class="section" id="iterator-adaptor-protected-member-functions">
<h3><a class="toc-backref" href="#id42" name="iterator-adaptor-protected-member-functions"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> protected member functions</a></h3> <h3><a class="toc-backref" href="#id36" name="iterator-adaptor-protected-member-functions"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> protected member functions</a></h3>
<p><tt class="literal"><span class="pre">Base</span> <span class="pre">const&amp;</span> <span class="pre">base_reference()</span> <span class="pre">const;</span></tt></p> <p><tt class="literal"><span class="pre">Base</span> <span class="pre">const&amp;</span> <span class="pre">base_reference()</span> <span class="pre">const;</span></tt></p>
<table class="field-list" frame="void" rules="none"> <table class="field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
@ -1149,7 +1140,7 @@ Inline emphasis start-string without end-string.</div>
</table> </table>
</div> </div>
<div class="section" id="iterator-adaptor-private-member-functions"> <div class="section" id="iterator-adaptor-private-member-functions">
<h3><a class="toc-backref" href="#id43" name="iterator-adaptor-private-member-functions"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> private member functions</a></h3> <h3><a class="toc-backref" href="#id37" name="iterator-adaptor-private-member-functions"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> private member functions</a></h3>
<p><tt class="literal"><span class="pre">typename</span> <span class="pre">iterator_adaptor::reference</span> <span class="pre">dereference()</span> <span class="pre">const;</span></tt></p> <p><tt class="literal"><span class="pre">typename</span> <span class="pre">iterator_adaptor::reference</span> <span class="pre">dereference()</span> <span class="pre">const;</span></tt></p>
<table class="field-list" frame="void" rules="none"> <table class="field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
@ -1218,7 +1209,7 @@ typename iterator_adaptor::difference_type distance_to(
</div> </div>
</div> </div>
<div class="section" id="specialized-adaptors-lib-iterator-special-adaptors"> <div class="section" id="specialized-adaptors-lib-iterator-special-adaptors">
<h2><a class="toc-backref" href="#id44" name="specialized-adaptors-lib-iterator-special-adaptors">Specialized adaptors [lib.iterator.special.adaptors]</a></h2> <h2><a class="toc-backref" href="#id38" name="specialized-adaptors-lib-iterator-special-adaptors">Specialized adaptors [lib.iterator.special.adaptors]</a></h2>
<p>The <tt class="literal"><span class="pre">enable_if_convertible&lt;X,Y&gt;::type</span></tt> expression used in <p>The <tt class="literal"><span class="pre">enable_if_convertible&lt;X,Y&gt;::type</span></tt> expression used in
this section is for exposition purposes. The converting constructors this section is for exposition purposes. The converting constructors
for specialized adaptors should be only be in an overload set provided for specialized adaptors should be only be in an overload set provided
@ -1247,7 +1238,7 @@ take the constructor out of the overload set when the types are not
implicitly convertible. implicitly convertible.
]</p> ]</p>
<div class="section" id="indirect-iterator"> <div class="section" id="indirect-iterator">
<h3><a class="toc-backref" href="#id45" name="indirect-iterator">Indirect iterator</a></h3> <h3><a class="toc-backref" href="#id39" name="indirect-iterator">Indirect iterator</a></h3>
<p>The indirect iterator adapts an iterator by applying an <em>extra</em> <p>The indirect iterator adapts an iterator by applying an <em>extra</em>
dereference inside of <tt class="literal"><span class="pre">operator*()</span></tt>. For example, this iterator dereference inside of <tt class="literal"><span class="pre">operator*()</span></tt>. For example, this iterator
adaptor makes it possible to view a container of pointers adaptor makes it possible to view a container of pointers
@ -1256,7 +1247,7 @@ adaptor makes it possible to view a container of pointers
<!-- At some point we should add the capability to handle <!-- At some point we should add the capability to handle
iterators over smart pointers, which the impl handles. -JGS --> iterators over smart pointers, which the impl handles. -JGS -->
<div class="section" id="class-template-indirect-iterator"> <div class="section" id="class-template-indirect-iterator">
<h4><a class="toc-backref" href="#id46" name="class-template-indirect-iterator">Class template <tt class="literal"><span class="pre">indirect_iterator</span></tt></a></h4> <h4><a class="toc-backref" href="#id40" name="class-template-indirect-iterator">Class template <tt class="literal"><span class="pre">indirect_iterator</span></tt></a></h4>
<pre class="literal-block"> <pre class="literal-block">
template &lt; template &lt;
class Iterator class Iterator
@ -1289,6 +1280,9 @@ class indirect_iterator
); );
Iterator base() const; Iterator base() const;
reference operator*() const;
indirect_iterator&amp; operator++();
indirect_iterator&amp; operator--();
private: private:
Iterator m_iterator; // exposition Iterator m_iterator; // exposition
}; };
@ -1325,7 +1319,7 @@ satisfies the requirements of the concepts modeled by the indirect
iterator as specified in the models section.</p> iterator as specified in the models section.</p>
</div> </div>
<div class="section" id="indirect-iterator-requirements"> <div class="section" id="indirect-iterator-requirements">
<h4><a class="toc-backref" href="#id47" name="indirect-iterator-requirements"><tt class="literal"><span class="pre">indirect_iterator</span></tt> requirements</a></h4> <h4><a class="toc-backref" href="#id41" name="indirect-iterator-requirements"><tt class="literal"><span class="pre">indirect_iterator</span></tt> requirements</a></h4>
<p>The <tt class="literal"><span class="pre">Iterator</span></tt> argument shall meet the requirements of Readable <p>The <tt class="literal"><span class="pre">Iterator</span></tt> argument shall meet the requirements of Readable
Iterator. The <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> argument shall be one of the Iterator. The <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> argument shall be one of the
standard iterator tags or <tt class="literal"><span class="pre">use_default</span></tt>. If <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> standard iterator tags or <tt class="literal"><span class="pre">use_default</span></tt>. If <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt>
@ -1341,7 +1335,7 @@ is not <tt class="literal"><span class="pre">use_default</span></tt>, as implied
default for the <tt class="literal"><span class="pre">value_type</span></tt> member.</p> default for the <tt class="literal"><span class="pre">value_type</span></tt> member.</p>
</div> </div>
<div class="section" id="indirect-iterator-models"> <div class="section" id="indirect-iterator-models">
<h4><a class="toc-backref" href="#id48" name="indirect-iterator-models"><tt class="literal"><span class="pre">indirect_iterator</span></tt> models</a></h4> <h4><a class="toc-backref" href="#id42" name="indirect-iterator-models"><tt class="literal"><span class="pre">indirect_iterator</span></tt> models</a></h4>
<p>If <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> is a standard iterator tag, <p>If <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> is a standard iterator tag,
<tt class="literal"><span class="pre">indirect_iterator</span></tt> is a model of the iterator concept corresponding <tt class="literal"><span class="pre">indirect_iterator</span></tt> is a model of the iterator concept corresponding
to the tag, otherwise <tt class="literal"><span class="pre">indirect_iterator</span></tt> satisfies the requirements to the tag, otherwise <tt class="literal"><span class="pre">indirect_iterator</span></tt> satisfies the requirements
@ -1355,7 +1349,10 @@ the <tt class="literal"><span class="pre">Iterator</span></tt> argument.</p>
<tt class="literal"><span class="pre">indirect_iterator</span></tt> models Lvalue Iterator.</p> <tt class="literal"><span class="pre">indirect_iterator</span></tt> models Lvalue Iterator.</p>
</div> </div>
<div class="section" id="indirect-iterator-operations"> <div class="section" id="indirect-iterator-operations">
<h4><a class="toc-backref" href="#id49" name="indirect-iterator-operations"><tt class="literal"><span class="pre">indirect_iterator</span></tt> operations</a></h4> <h4><a class="toc-backref" href="#id43" name="indirect-iterator-operations"><tt class="literal"><span class="pre">indirect_iterator</span></tt> operations</a></h4>
<p>In addition to the operations required by the concepts modeled by
<tt class="literal"><span class="pre">indirect_iterator</span></tt>, <tt class="literal"><span class="pre">indirect_iterator</span></tt> provides the following
operations.</p>
<p><tt class="literal"><span class="pre">indirect_iterator();</span></tt></p> <p><tt class="literal"><span class="pre">indirect_iterator();</span></tt></p>
<table class="field-list" frame="void" rules="none"> <table class="field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
@ -1410,16 +1407,47 @@ indirect_iterator(
</tr> </tr>
</tbody> </tbody>
</table> </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" />
<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">indirect_iterator&amp;</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">++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>
</tbody>
</table>
<p><tt class="literal"><span class="pre">indirect_iterator&amp;</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">--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>
</tbody>
</table>
</div> </div>
</div> </div>
<div class="section" id="reverse-iterator"> <div class="section" id="reverse-iterator">
<h3><a class="toc-backref" href="#id50" name="reverse-iterator">Reverse iterator</a></h3> <h3><a class="toc-backref" href="#id44" name="reverse-iterator">Reverse iterator</a></h3>
<!-- I think we'd better strike the old reverse_iterator text from the standard, eh? --> <!-- I think we'd better strike the old reverse_iterator text from the standard, eh? -->
<p>The reverse iterator adaptor flips the direction of a base iterator's <p>The reverse iterator adaptor flips the direction of a base iterator's
motion. Invoking <tt class="literal"><span class="pre">operator++()</span></tt> moves the base iterator backward and motion. Invoking <tt class="literal"><span class="pre">operator++()</span></tt> moves the base iterator backward and
invoking <tt class="literal"><span class="pre">operator--()</span></tt> moves the base iterator forward.</p> invoking <tt class="literal"><span class="pre">operator--()</span></tt> moves the base iterator forward.</p>
<div class="section" id="class-template-reverse-iterator"> <div class="section" id="class-template-reverse-iterator">
<h4><a class="toc-backref" href="#id51" name="class-template-reverse-iterator">Class template <tt class="literal"><span class="pre">reverse_iterator</span></tt></a></h4> <h4><a class="toc-backref" href="#id45" name="class-template-reverse-iterator">Class template <tt class="literal"><span class="pre">reverse_iterator</span></tt></a></h4>
<pre class="literal-block"> <pre class="literal-block">
template &lt;class Iterator&gt; template &lt;class Iterator&gt;
class reverse_iterator class reverse_iterator
@ -1436,25 +1464,29 @@ public:
Iterator base() const; Iterator base() const;
reference operator*() const; reference operator*() const;
reverse_iterator&amp; operator++(); reverse_iterator&amp; operator++();
reverse_iterator&amp; operator--();
private: private:
Iterator m_iterator; // exposition Iterator m_iterator; // exposition
}; };
</pre> </pre>
</div> </div>
<div class="section" id="reverse-iterator-requirements"> <div class="section" id="reverse-iterator-requirements">
<h4><a class="toc-backref" href="#id52" name="reverse-iterator-requirements"><tt class="literal"><span class="pre">reverse_iterator</span></tt> requirements</a></h4> <h4><a class="toc-backref" href="#id46" 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 <p>The base <tt class="literal"><span class="pre">Iterator</span></tt> must be a model of Bidirectional Traversal
Iterator and Readable Iterator.</p> Iterator and Readable Iterator.</p>
</div> </div>
<div class="section" id="reverse-iterator-models"> <div class="section" id="reverse-iterator-models">
<h4><a class="toc-backref" href="#id53" name="reverse-iterator-models"><tt class="literal"><span class="pre">reverse_iterator</span></tt> models</a></h4> <h4><a class="toc-backref" href="#id47" 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 <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 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> standard iterator access concepts that the <tt class="literal"><span class="pre">Iterator</span></tt>
argument models.</p> argument models.</p>
</div> </div>
<div class="section" id="reverse-iterator-operations"> <div class="section" id="reverse-iterator-operations">
<h4><a class="toc-backref" href="#id54" name="reverse-iterator-operations"><tt class="literal"><span class="pre">reverse_iterator</span></tt> operations</a></h4> <h4><a class="toc-backref" href="#id48" name="reverse-iterator-operations"><tt class="literal"><span class="pre">reverse_iterator</span></tt> operations</a></h4>
<p>In addition to the operations required by the concepts modeled by
<tt class="literal"><span class="pre">reverse_iterator</span></tt>, <tt class="literal"><span class="pre">reverse_iterator</span></tt> provides the following
operations.</p>
<p><tt class="literal"><span class="pre">reverse_iterator();</span></tt></p> <p><tt class="literal"><span class="pre">reverse_iterator();</span></tt></p>
<table class="field-list" frame="void" rules="none"> <table class="field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
@ -1527,17 +1559,28 @@ return *..tmp;
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p><tt class="literal"><span class="pre">reverse_iterator&amp;</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">++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>
</tbody>
</table>
</div> </div>
</div> </div>
<div class="section" id="transform-iterator"> <div class="section" id="transform-iterator">
<h3><a class="toc-backref" href="#id55" name="transform-iterator">Transform iterator</a></h3> <h3><a class="toc-backref" href="#id49" name="transform-iterator">Transform iterator</a></h3>
<p>The transform iterator adapts an iterator by applying some function <p>The transform iterator adapts an iterator by applying some function
object to the result of dereferencing the iterator. In other words, object to the result of dereferencing the iterator. In other words,
the <tt class="literal"><span class="pre">operator*</span></tt> of the transform iterator first dereferences the the <tt class="literal"><span class="pre">operator*</span></tt> of the transform iterator first dereferences the
base iterator, passes the result of this to the function object, and base iterator, passes the result of this to the function object, and
then returns the result.</p> then returns the result.</p>
<div class="section" id="class-template-transform-iterator"> <div class="section" id="class-template-transform-iterator">
<h4><a class="toc-backref" href="#id56" name="class-template-transform-iterator">Class template <tt class="literal"><span class="pre">transform_iterator</span></tt></a></h4> <h4><a class="toc-backref" href="#id50" name="class-template-transform-iterator">Class template <tt class="literal"><span class="pre">transform_iterator</span></tt></a></h4>
<!-- Version 1.3 of this document was accepted for TR1 --> <!-- Version 1.3 of this document was accepted for TR1 -->
<pre class="literal-block"> <pre class="literal-block">
template &lt;class UnaryFunction, template &lt;class UnaryFunction,
@ -1556,11 +1599,11 @@ public:
, typename enable_if_convertible&lt;I2, Iterator&gt;::type* = 0 // exposition , typename enable_if_convertible&lt;I2, Iterator&gt;::type* = 0 // exposition
, typename enable_if_convertible&lt;F2, UnaryFunction&gt;::type* = 0 // exposition , typename enable_if_convertible&lt;F2, UnaryFunction&gt;::type* = 0 // exposition
); );
reference operator*() const;
transform_iterator&amp; operator++();
Iterator base() const; Iterator base() const;
UnaryFunction functor() const; UnaryFunction functor() const;
reference operator*() const;
transform_iterator&amp; operator++();
transform_iterator&amp; operator--();
private: private:
Iterator m_iterator; // exposition Iterator m_iterator; // exposition
UnaryFunction m_f; // exposition UnaryFunction m_f; // exposition
@ -1568,7 +1611,7 @@ private:
</pre> </pre>
</div> </div>
<div class="section" id="transform-iterator-requirements"> <div class="section" id="transform-iterator-requirements">
<h4><a class="toc-backref" href="#id57" name="transform-iterator-requirements"><tt class="literal"><span class="pre">transform_iterator</span></tt> requirements</a></h4> <h4><a class="toc-backref" href="#id51" 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 <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 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 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
@ -1577,7 +1620,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> <p>The type <tt class="literal"><span class="pre">Iterator</span></tt> must at least model Readable Iterator.</p>
</div> </div>
<div class="section" id="transform-iterator-models"> <div class="section" id="transform-iterator-models">
<h4><a class="toc-backref" href="#id58" name="transform-iterator-models"><tt class="literal"><span class="pre">transform_iterator</span></tt> models</a></h4> <h4><a class="toc-backref" href="#id52" 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 <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> following options that is also modeled by <tt class="literal"><span class="pre">Iterator</span></tt>.</p>
<blockquote> <blockquote>
@ -1595,7 +1638,10 @@ 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&lt;remove_reference&lt;reference&gt;</span> <span class="pre">&gt;::type</span></tt>.</p> The <tt class="literal"><span class="pre">value_type</span></tt> is <tt class="literal"><span class="pre">remove_cv&lt;remove_reference&lt;reference&gt;</span> <span class="pre">&gt;::type</span></tt>.</p>
</div> </div>
<div class="section" id="transform-iterator-operations"> <div class="section" id="transform-iterator-operations">
<h4><a class="toc-backref" href="#id59" name="transform-iterator-operations"><tt class="literal"><span class="pre">transform_iterator</span></tt> operations</a></h4> <h4><a class="toc-backref" href="#id53" name="transform-iterator-operations"><tt class="literal"><span class="pre">transform_iterator</span></tt> operations</a></h4>
<p>In addition to the operations required by the concepts modeled by
<tt class="literal"><span class="pre">transform_iterator</span></tt>, <tt class="literal"><span class="pre">transform_iterator</span></tt> provides the following
operations.</p>
<p><tt class="literal"><span class="pre">transform_iterator();</span></tt></p> <p><tt class="literal"><span class="pre">transform_iterator();</span></tt></p>
<table class="field-list" frame="void" rules="none"> <table class="field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
@ -1671,10 +1717,21 @@ transform_iterator(
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p><tt class="literal"><span class="pre">transform_iterator&amp;</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">--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>
</tbody>
</table>
</div> </div>
</div> </div>
<div class="section" id="filter-iterator"> <div class="section" id="filter-iterator">
<h3><a class="toc-backref" href="#id60" name="filter-iterator">Filter iterator</a></h3> <h3><a class="toc-backref" href="#id54" name="filter-iterator">Filter iterator</a></h3>
<p>The filter iterator adaptor creates a view of an iterator range in <p>The filter iterator adaptor creates a view of an iterator range in
which some elements of the range are skipped over. A predicate which some elements of the range are skipped over. A predicate
function object controls which elements are skipped. When the function object controls which elements are skipped. When the
@ -1686,7 +1743,7 @@ of the underlying range. Therefore the constructor of the filter
iterator takes two iterator parameters: the position for the filtered iterator takes two iterator parameters: the position for the filtered
iterator and the end of the range.</p> iterator and the end of the range.</p>
<div class="section" id="class-template-filter-iterator"> <div class="section" id="class-template-filter-iterator">
<h4><a class="toc-backref" href="#id61" name="class-template-filter-iterator">Class template <tt class="literal"><span class="pre">filter_iterator</span></tt></a></h4> <h4><a class="toc-backref" href="#id55" name="class-template-filter-iterator">Class template <tt class="literal"><span class="pre">filter_iterator</span></tt></a></h4>
<pre class="literal-block"> <pre class="literal-block">
template &lt;class Predicate, class Iterator&gt; template &lt;class Predicate, class Iterator&gt;
class filter_iterator class filter_iterator
@ -1722,7 +1779,7 @@ corresponding to each standard concept modeled by <tt class="literal"><span clas
as described in the models section.</p> as described in the models section.</p>
</div> </div>
<div class="section" id="filter-iterator-requirements"> <div class="section" id="filter-iterator-requirements">
<h4><a class="toc-backref" href="#id62" name="filter-iterator-requirements"><tt class="literal"><span class="pre">filter_iterator</span></tt> requirements</a></h4> <h4><a class="toc-backref" href="#id56" 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 <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 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 <tt class="literal"><span class="pre">Predicate</span></tt>, <tt class="literal"><span class="pre">x</span></tt> is an object of type
@ -1733,7 +1790,7 @@ Iterator and Single Pass Iterator or it shall meet the requirements of
Input Iterator.</p> Input Iterator.</p>
</div> </div>
<div class="section" id="filter-iterator-models"> <div class="section" id="filter-iterator-models">
<h4><a class="toc-backref" href="#id63" name="filter-iterator-models"><tt class="literal"><span class="pre">filter_iterator</span></tt> models</a></h4> <h4><a class="toc-backref" href="#id57" 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 <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 concepts the <tt class="literal"><span class="pre">Iterator</span></tt> argument models, as specified in the
following tables.</p> following tables.</p>
@ -1802,7 +1859,7 @@ following tables.</p>
</table> </table>
</div> </div>
<div class="section" id="filter-iterator-operations"> <div class="section" id="filter-iterator-operations">
<h4><a class="toc-backref" href="#id64" name="filter-iterator-operations"><tt class="literal"><span class="pre">filter_iterator</span></tt> operations</a></h4> <h4><a class="toc-backref" href="#id58" 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 <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 <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> operations.</p>
@ -1912,11 +1969,11 @@ or <tt class="literal"><span class="pre">m_pred(*m_iter)</span> <span class="pre
</div> </div>
</div> </div>
<div class="section" id="counting-iterator"> <div class="section" id="counting-iterator">
<h3><a class="toc-backref" href="#id65" name="counting-iterator">Counting iterator</a></h3> <h3><a class="toc-backref" href="#id59" 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 <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
adding an <tt class="literal"><span class="pre">operator*</span></tt> that returns the current value of the object.</p> adding an <tt class="literal"><span class="pre">operator*</span></tt> that returns the current value of the object.</p>
<div class="section" id="class-template-counting-iterator"> <div class="section" id="class-template-counting-iterator">
<h4><a class="toc-backref" href="#id66" name="class-template-counting-iterator">Class template <tt class="literal"><span class="pre">counting_iterator</span></tt></a></h4> <h4><a class="toc-backref" href="#id60" name="class-template-counting-iterator">Class template <tt class="literal"><span class="pre">counting_iterator</span></tt></a></h4>
<pre class="literal-block"> <pre class="literal-block">
template &lt; template &lt;
class Incrementable class Incrementable
@ -1930,8 +1987,11 @@ class counting_iterator
counting_iterator(counting_iterator const&amp; rhs); counting_iterator(counting_iterator const&amp; rhs);
explicit counting_iterator(Incrementable x); explicit counting_iterator(Incrementable x);
Incrementable base() const; Incrementable base() const;
reference operator*() const;
counting_iterator&amp; operator++();
counting_iterator&amp; operator--();
private: private:
Incrementable current; // exposition Incrementable m_inc; // exposition
}; };
</pre> </pre>
<dl> <dl>
@ -1941,13 +2001,13 @@ the cases when the <tt class="literal"><span class="pre">Incrementable</span></t
</dl> </dl>
</div> </div>
<div class="section" id="counting-iterator-requirements"> <div class="section" id="counting-iterator-requirements">
<h4><a class="toc-backref" href="#id67" name="counting-iterator-requirements"><tt class="literal"><span class="pre">counting_iterator</span></tt> requirements</a></h4> <h4><a class="toc-backref" href="#id61" 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 <p>The <tt class="literal"><span class="pre">Incrementable</span></tt> type must be Default Constructible, Copy
Constructible, and Assignable. The default distance is Constructible, and Assignable. The default distance is
an implementation defined signed integral type.</p> an implementation defined signed integral type.</p>
</div> </div>
<div class="section" id="counting-iterator-models"> <div class="section" id="counting-iterator-models">
<h4><a class="toc-backref" href="#id68" name="counting-iterator-models"><tt class="literal"><span class="pre">counting_iterator</span></tt> models</a></h4> <h4><a class="toc-backref" href="#id62" 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><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 <p>Furthermore, if you wish to create a counting iterator that is a Forward
Traversal Iterator, then the following expressions must be valid:</p> Traversal Iterator, then the following expressions must be valid:</p>
@ -1972,7 +2032,10 @@ i &lt; j
</pre> </pre>
</div> </div>
<div class="section" id="counting-iterator-operations"> <div class="section" id="counting-iterator-operations">
<h4><a class="toc-backref" href="#id69" name="counting-iterator-operations"><tt class="literal"><span class="pre">counting_iterator</span></tt> operations</a></h4> <h4><a class="toc-backref" href="#id63" name="counting-iterator-operations"><tt class="literal"><span class="pre">counting_iterator</span></tt> operations</a></h4>
<p>In addition to the operations required by the concepts modeled by
<tt class="literal"><span class="pre">counting_iterator</span></tt>, <tt class="literal"><span class="pre">counting_iterator</span></tt> provides the following
operations.</p>
<p><tt class="literal"><span class="pre">counting_iterator();</span></tt></p> <p><tt class="literal"><span class="pre">counting_iterator();</span></tt></p>
<table class="field-list" frame="void" rules="none"> <table class="field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
@ -1996,7 +2059,7 @@ i &lt; j
<col class="field-name" /> <col class="field-name" />
<col class="field-body" /> <col class="field-body" />
<tbody valign="top"> <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">counting_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">counting_iterator</span></tt> with <tt class="literal"><span class="pre">m_inc</span></tt>
constructed from <tt class="literal"><span class="pre">x</span></tt>.</td> constructed from <tt class="literal"><span class="pre">x</span></tt>.</td>
</tr> </tr>
</tbody> </tbody>
@ -2006,7 +2069,7 @@ constructed from <tt class="literal"><span class="pre">x</span></tt>.</td>
<col class="field-name" /> <col class="field-name" />
<col class="field-body" /> <col class="field-body" />
<tbody valign="top"> <tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">current</span></tt></td> <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">m_inc</span></tt></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -2015,7 +2078,20 @@ constructed from <tt class="literal"><span class="pre">x</span></tt>.</td>
<col class="field-name" /> <col class="field-name" />
<col class="field-body" /> <col class="field-body" />
<tbody valign="top"> <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_inc</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>
</tbody>
</table>
<p><tt class="literal"><span class="pre">counting_iterator&amp;</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">--m_inc</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> </tr>
</tbody> </tbody>
</table> </table>
@ -2024,14 +2100,14 @@ constructed from <tt class="literal"><span class="pre">x</span></tt>.</td>
<col class="field-name" /> <col class="field-name" />
<col class="field-body" /> <col class="field-body" />
<tbody valign="top"> <tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">current</span></tt></td> <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="literal"><span class="pre">m_inc</span></tt></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<div class="section" id="function-output-iterator"> <div class="section" id="function-output-iterator">
<h3><a class="toc-backref" href="#id70" name="function-output-iterator">Function output iterator</a></h3> <h3><a class="toc-backref" href="#id64" name="function-output-iterator">Function output iterator</a></h3>
<p>The function output iterator adaptor makes it easier to create custom <p>The function output iterator adaptor makes it easier to create custom
output iterators. The adaptor takes a unary function and creates a output iterators. The adaptor takes a unary function and creates a
model of Output Iterator. Each item assigned to the output iterator is model of Output Iterator. Each item assigned to the output iterator is
@ -2040,7 +2116,7 @@ iterator is that creating a conforming output iterator is non-trivial,
particularly because the proper implementation usually requires a particularly because the proper implementation usually requires a
proxy object.</p> proxy object.</p>
<div class="section" id="class-template-function-output-iterator"> <div class="section" id="class-template-function-output-iterator">
<h4><a class="toc-backref" href="#id71" name="class-template-function-output-iterator">Class template <tt class="literal"><span class="pre">function_output_iterator</span></tt></a></h4> <h4><a class="toc-backref" href="#id65" name="class-template-function-output-iterator">Class template <tt class="literal"><span class="pre">function_output_iterator</span></tt></a></h4>
<pre class="literal-block"> <pre class="literal-block">
template &lt;class UnaryFunction&gt; template &lt;class UnaryFunction&gt;
class function_output_iterator { class function_output_iterator {
@ -2067,7 +2143,7 @@ public:
</pre> </pre>
</div> </div>
<div class="section" id="function-output-iterator-requirements"> <div class="section" id="function-output-iterator-requirements">
<h4><a class="toc-backref" href="#id72" name="function-output-iterator-requirements"><tt class="literal"><span class="pre">function_output_iterator</span></tt> requirements</a></h4> <h4><a class="toc-backref" href="#id66" 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 <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 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>. <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>.
@ -2075,7 +2151,7 @@ The resulting <tt class="literal"><span class="pre">function_output_iterator</sp
and Incrementable Iterator concepts.</p> and Incrementable Iterator concepts.</p>
</div> </div>
<div class="section" id="function-output-iterator-operations"> <div class="section" id="function-output-iterator-operations">
<h4><a class="toc-backref" href="#id73" name="function-output-iterator-operations"><tt class="literal"><span class="pre">function_output_iterator</span></tt> operations</a></h4> <h4><a class="toc-backref" href="#id67" 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&amp;</span> <span class="pre">f</span> <span class="pre">=</span> <span class="pre">UnaryFunction());</span></tt></p> <p><tt class="literal"><span class="pre">explicit</span> <span class="pre">function_output_iterator(const</span> <span class="pre">UnaryFunction&amp;</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"> <table class="field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
@ -2116,7 +2192,7 @@ a copy of the unary function <tt class="literal"><span class="pre">f</span></tt>
</table> </table>
</div> </div>
<div class="section" id="function-output-iterator-output-proxy-operations"> <div class="section" id="function-output-iterator-output-proxy-operations">
<h4><a class="toc-backref" href="#id74" name="function-output-iterator-output-proxy-operations"><tt class="literal"><span class="pre">function_output_iterator::output_proxy</span></tt> operations</a></h4> <h4><a class="toc-backref" href="#id68" 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&amp;</span> <span class="pre">f);</span></tt></p> <p><tt class="literal"><span class="pre">output_proxy(UnaryFunction&amp;</span> <span class="pre">f);</span></tt></p>
<table class="field-list" frame="void" rules="none"> <table class="field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
@ -2154,7 +2230,7 @@ LocalWords: OtherIncrementable Coplien -->
<hr class="footer"/> <hr class="footer"/>
<div class="footer"> <div class="footer">
<a class="reference" href="facade-and-adaptor.rst">View document source</a>. <a class="reference" href="facade-and-adaptor.rst">View document source</a>.
Generated on: 2004-01-12 15:21 UTC. Generated on: 2004-01-12 15:41 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. 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> </div>
</body> </body>

View File

@ -53,12 +53,15 @@ iterator and the end of the range.</p>
<div class="contents topic" id="table-of-contents"> <div class="contents topic" id="table-of-contents">
<p class="topic-title"><a name="table-of-contents">Table of Contents</a></p> <p class="topic-title"><a name="table-of-contents">Table of Contents</a></p>
<ul class="simple"> <ul class="simple">
<li><a class="reference" href="#filter-iterator-requirements" id="id1" name="id1"><tt class="literal"><span class="pre">filter_iterator</span></tt> requirements</a></li> <li><a class="reference" href="#filter-iterator-synopsis" id="id1" name="id1"><tt class="literal"><span class="pre">filter_iterator</span></tt> synopsis</a></li>
<li><a class="reference" href="#filter-iterator-models" id="id2" name="id2"><tt class="literal"><span class="pre">filter_iterator</span></tt> models</a></li> <li><a class="reference" href="#filter-iterator-requirements" id="id2" name="id2"><tt class="literal"><span class="pre">filter_iterator</span></tt> requirements</a></li>
<li><a class="reference" href="#filter-iterator-operations" id="id3" name="id3"><tt class="literal"><span class="pre">filter_iterator</span></tt> operations</a></li> <li><a class="reference" href="#filter-iterator-models" id="id3" name="id3"><tt class="literal"><span class="pre">filter_iterator</span></tt> models</a></li>
<li><a class="reference" href="#example" id="id4" name="id4">Example</a></li> <li><a class="reference" href="#filter-iterator-operations" id="id4" name="id4"><tt class="literal"><span class="pre">filter_iterator</span></tt> operations</a></li>
<li><a class="reference" href="#example" id="id5" name="id5">Example</a></li>
</ul> </ul>
</div> </div>
<div class="section" id="filter-iterator-synopsis">
<h1><a class="toc-backref" href="#id1" name="filter-iterator-synopsis"><tt class="literal"><span class="pre">filter_iterator</span></tt> synopsis</a></h1>
<pre class="literal-block"> <pre class="literal-block">
template &lt;class Predicate, class Iterator&gt; template &lt;class Predicate, class Iterator&gt;
class filter_iterator class filter_iterator
@ -92,8 +95,9 @@ private:
<p>The <tt class="literal"><span class="pre">iterator_category</span></tt> member is a type convertible to the tags <p>The <tt class="literal"><span class="pre">iterator_category</span></tt> member is a type convertible to the tags
corresponding to each standard concept modeled by <tt class="literal"><span class="pre">filter_iterator</span></tt>, corresponding to each standard concept modeled by <tt class="literal"><span class="pre">filter_iterator</span></tt>,
as described in the models section.</p> as described in the models section.</p>
</div>
<div class="section" id="filter-iterator-requirements"> <div class="section" id="filter-iterator-requirements">
<h1><a class="toc-backref" href="#id1" name="filter-iterator-requirements"><tt class="literal"><span class="pre">filter_iterator</span></tt> requirements</a></h1> <h1><a class="toc-backref" href="#id2" name="filter-iterator-requirements"><tt class="literal"><span class="pre">filter_iterator</span></tt> requirements</a></h1>
<p>The <tt class="literal"><span class="pre">Predicate</span></tt> argument must be Assignable, Copy Constructible, and <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 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 <tt class="literal"><span class="pre">Predicate</span></tt>, <tt class="literal"><span class="pre">x</span></tt> is an object of type
@ -104,7 +108,7 @@ Iterator and Single Pass Iterator or it shall meet the requirements of
Input Iterator.</p> Input Iterator.</p>
</div> </div>
<div class="section" id="filter-iterator-models"> <div class="section" id="filter-iterator-models">
<h1><a class="toc-backref" href="#id2" name="filter-iterator-models"><tt class="literal"><span class="pre">filter_iterator</span></tt> models</a></h1> <h1><a class="toc-backref" href="#id3" name="filter-iterator-models"><tt class="literal"><span class="pre">filter_iterator</span></tt> models</a></h1>
<p>The concepts that <tt class="literal"><span class="pre">filter_iterator</span></tt> models are dependent on what <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 concepts the <tt class="literal"><span class="pre">Iterator</span></tt> argument models, as specified in the
following tables.</p> following tables.</p>
@ -173,7 +177,7 @@ following tables.</p>
</table> </table>
</div> </div>
<div class="section" id="filter-iterator-operations"> <div class="section" id="filter-iterator-operations">
<h1><a class="toc-backref" href="#id3" name="filter-iterator-operations"><tt class="literal"><span class="pre">filter_iterator</span></tt> operations</a></h1> <h1><a class="toc-backref" href="#id4" name="filter-iterator-operations"><tt class="literal"><span class="pre">filter_iterator</span></tt> operations</a></h1>
<p>In addition to those operations required by the concepts that <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 <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> operations.</p>
@ -313,7 +317,7 @@ constructed <tt class="literal"><span class="pre">Predicate</span></tt>, or else
</table> </table>
</div> </div>
<div class="section" id="example"> <div class="section" id="example">
<h1><a class="toc-backref" href="#id4" name="example">Example</a></h1> <h1><a class="toc-backref" href="#id5" name="example">Example</a></h1>
<p>This example uses <tt class="literal"><span class="pre">filter_iterator</span></tt> and then <p>This example uses <tt class="literal"><span class="pre">filter_iterator</span></tt> and then
<tt class="literal"><span class="pre">make_filter_iterator</span></tt> to output only the positive integers from an <tt class="literal"><span class="pre">make_filter_iterator</span></tt> to output only the positive integers from an
array of integers. Then <tt class="literal"><span class="pre">make_filter_iterator</span></tt> is is used to output array of integers. Then <tt class="literal"><span class="pre">make_filter_iterator</span></tt> is is used to output
@ -377,7 +381,7 @@ int main()
<hr class="footer"/> <hr class="footer"/>
<div class="footer"> <div class="footer">
<a class="reference" href="filter_iterator.rst">View document source</a>. <a class="reference" href="filter_iterator.rst">View document source</a>.
Generated on: 2004-01-12 15:20 UTC. Generated on: 2004-01-12 15: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. 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> </div>
</body> </body>

View File

@ -20,6 +20,9 @@
.. contents:: Table of Contents .. contents:: Table of Contents
``filter_iterator`` synopsis
............................
.. include:: filter_iterator_ref.rst .. include:: filter_iterator_ref.rst
.. include:: make_filter_iterator.rst .. include:: make_filter_iterator.rst

View File

@ -150,8 +150,8 @@ testing iterator interoperability</li>
<div class="section" id="testing-and-concept-checking"> <div class="section" id="testing-and-concept-checking">
<h2><a class="toc-backref" href="#id11" name="testing-and-concept-checking">Testing and Concept Checking</a></h2> <h2><a class="toc-backref" href="#id11" name="testing-and-concept-checking">Testing and Concept Checking</a></h2>
<ul class="simple"> <ul class="simple">
<li><a class="reference" href="iterator_archetypes.html"><tt class="literal"><span class="pre">iterator_archetypes.hpp</span></tt></a>: Add summary here</li> <li><a class="reference" href="iterator_concepts.html"><tt class="literal"><span class="pre">iterator_concepts.hpp</span></tt></a>: Concept checking classes for the new iterator concepts.</li>
<li><a class="reference" href="iterator_concepts.html"><tt class="literal"><span class="pre">iterator_concepts.hpp</span></tt></a>: Add summary</li> <li><a class="reference" href="iterator_archetypes.html"><tt class="literal"><span class="pre">iterator_archetypes.hpp</span></tt></a>: Concept archetype classes for the new iterators concepts.</li>
</ul> </ul>
</div> </div>
</div> </div>
@ -226,7 +226,7 @@ LocalWords: TraversalTag typename lvalues DWA Hmm JGS -->
<hr class="footer"/> <hr class="footer"/>
<div class="footer"> <div class="footer">
<a class="reference" href="index.rst">View document source</a>. <a class="reference" href="index.rst">View document source</a>.
Generated on: 2004-01-12 15:06 UTC. Generated on: 2004-01-12 15:41 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. 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> </div>
</body> </body>

View File

@ -187,16 +187,16 @@ Traits
Testing and Concept Checking Testing and Concept Checking
---------------------------- ----------------------------
* |iterator_archetypes|_: Add summary here * |iterator_concepts|_: Concept checking classes for the new iterator concepts.
* |iterator_concepts|_: Add summary * |iterator_archetypes|_: Concept archetype classes for the new iterators concepts.
.. |iterator_archetypes| replace:: ``iterator_archetypes.hpp``
.. _iterator_archetypes: iterator_archetypes.html
.. |iterator_concepts| replace:: ``iterator_concepts.hpp`` .. |iterator_concepts| replace:: ``iterator_concepts.hpp``
.. _iterator_concepts: iterator_concepts.html .. _iterator_concepts: iterator_concepts.html
.. |iterator_archetypes| replace:: ``iterator_archetypes.hpp``
.. _iterator_archetypes: iterator_archetypes.html
======================================================= =======================================================
Upgrading from the old Boost Iterator Adaptor Library Upgrading from the old Boost Iterator Adaptor Library

View File

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.0: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils 0.2.8: http://docutils.sourceforge.net/" />
<title>Indirect Iterator</title> <title>Indirect Iterator</title>
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" /> <meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" /> <meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
@ -50,12 +50,15 @@ iterators over smart pointers, which the impl handles. -JGS -->
<div class="contents topic" id="table-of-contents"> <div class="contents topic" id="table-of-contents">
<p class="topic-title"><a name="table-of-contents">Table of Contents</a></p> <p class="topic-title"><a name="table-of-contents">Table of Contents</a></p>
<ul class="simple"> <ul class="simple">
<li><a class="reference" href="#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-synopsis" id="id1" name="id1"><tt class="literal"><span class="pre">indirect_iterator</span></tt> synopsis</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-requirements" id="id2" name="id2"><tt class="literal"><span class="pre">indirect_iterator</span></tt> requirements</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="#indirect-iterator-models" id="id3" name="id3"><tt class="literal"><span class="pre">indirect_iterator</span></tt> models</a></li>
<li><a class="reference" href="#example" id="id4" name="id4">Example</a></li> <li><a class="reference" href="#indirect-iterator-operations" id="id4" name="id4"><tt class="literal"><span class="pre">indirect_iterator</span></tt> operations</a></li>
<li><a class="reference" href="#example" id="id5" name="id5">Example</a></li>
</ul> </ul>
</div> </div>
<div class="section" id="indirect-iterator-synopsis">
<h1><a class="toc-backref" href="#id1" name="indirect-iterator-synopsis"><tt class="literal"><span class="pre">indirect_iterator</span></tt> synopsis</a></h1>
<pre class="literal-block"> <pre class="literal-block">
template &lt; template &lt;
class Iterator class Iterator
@ -88,6 +91,9 @@ class indirect_iterator
); );
Iterator base() const; Iterator base() const;
reference operator*() const;
indirect_iterator&amp; operator++();
indirect_iterator&amp; operator--();
private: private:
Iterator m_iterator; // exposition Iterator m_iterator; // exposition
}; };
@ -122,8 +128,9 @@ else
<p>The member <tt class="literal"><span class="pre">indirect_iterator::iterator_category</span></tt> is a type that <p>The member <tt class="literal"><span class="pre">indirect_iterator::iterator_category</span></tt> is a type that
satisfies the requirements of the concepts modeled by the indirect satisfies the requirements of the concepts modeled by the indirect
iterator as specified in the models section.</p> iterator as specified in the models section.</p>
</div>
<div class="section" id="indirect-iterator-requirements"> <div class="section" id="indirect-iterator-requirements">
<h1><a class="toc-backref" href="#id1" name="indirect-iterator-requirements"><tt class="literal"><span class="pre">indirect_iterator</span></tt> requirements</a></h1> <h1><a class="toc-backref" href="#id2" name="indirect-iterator-requirements"><tt class="literal"><span class="pre">indirect_iterator</span></tt> requirements</a></h1>
<p>The <tt class="literal"><span class="pre">Iterator</span></tt> argument shall meet the requirements of Readable <p>The <tt class="literal"><span class="pre">Iterator</span></tt> argument shall meet the requirements of Readable
Iterator. The <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> argument shall be one of the Iterator. The <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> argument shall be one of the
standard iterator tags or <tt class="literal"><span class="pre">use_default</span></tt>. If <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> standard iterator tags or <tt class="literal"><span class="pre">use_default</span></tt>. If <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt>
@ -139,7 +146,7 @@ is not <tt class="literal"><span class="pre">use_default</span></tt>, as implied
default for the <tt class="literal"><span class="pre">value_type</span></tt> member.</p> default for the <tt class="literal"><span class="pre">value_type</span></tt> member.</p>
</div> </div>
<div class="section" id="indirect-iterator-models"> <div class="section" id="indirect-iterator-models">
<h1><a class="toc-backref" href="#id2" name="indirect-iterator-models"><tt class="literal"><span class="pre">indirect_iterator</span></tt> models</a></h1> <h1><a class="toc-backref" href="#id3" name="indirect-iterator-models"><tt class="literal"><span class="pre">indirect_iterator</span></tt> models</a></h1>
<p>If <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> is a standard iterator tag, <p>If <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> is a standard iterator tag,
<tt class="literal"><span class="pre">indirect_iterator</span></tt> is a model of the iterator concept corresponding <tt class="literal"><span class="pre">indirect_iterator</span></tt> is a model of the iterator concept corresponding
to the tag, otherwise <tt class="literal"><span class="pre">indirect_iterator</span></tt> satisfies the requirements to the tag, otherwise <tt class="literal"><span class="pre">indirect_iterator</span></tt> satisfies the requirements
@ -153,7 +160,10 @@ the <tt class="literal"><span class="pre">Iterator</span></tt> argument.</p>
<tt class="literal"><span class="pre">indirect_iterator</span></tt> models Lvalue Iterator.</p> <tt class="literal"><span class="pre">indirect_iterator</span></tt> models Lvalue Iterator.</p>
</div> </div>
<div class="section" id="indirect-iterator-operations"> <div class="section" id="indirect-iterator-operations">
<h1><a class="toc-backref" href="#id3" name="indirect-iterator-operations"><tt class="literal"><span class="pre">indirect_iterator</span></tt> operations</a></h1> <h1><a class="toc-backref" href="#id4" name="indirect-iterator-operations"><tt class="literal"><span class="pre">indirect_iterator</span></tt> operations</a></h1>
<p>In addition to the operations required by the concepts modeled by
<tt class="literal"><span class="pre">indirect_iterator</span></tt>, <tt class="literal"><span class="pre">indirect_iterator</span></tt> provides the following
operations.</p>
<p><tt class="literal"><span class="pre">indirect_iterator();</span></tt></p> <p><tt class="literal"><span class="pre">indirect_iterator();</span></tt></p>
<table class="field-list" frame="void" rules="none"> <table class="field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
@ -208,9 +218,48 @@ indirect_iterator(
</tr> </tr>
</tbody> </tbody>
</table> </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" />
<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">indirect_iterator&amp;</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">++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>
</tbody>
</table>
<p><tt class="literal"><span class="pre">indirect_iterator&amp;</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">--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>
</tbody>
</table>
</div> </div>
<div class="section" id="example"> <div class="section" id="example">
<h1><a class="toc-backref" href="#id4" name="example">Example</a></h1> <h1><a class="toc-backref" href="#id5" name="example">Example</a></h1>
<p>This example prints an array of characters, using
<tt class="literal"><span class="pre">indirect_iterator</span></tt> to access the array of characters through an
array of pointers. Next <tt class="literal"><span class="pre">indirect_iterator</span></tt> is used with the
<tt class="literal"><span class="pre">transform</span></tt> algorithm to copy the characters (incremented by one) to
another array. A constant indirect iterator is used for the source and
a mutable indirect iterator is used for the destination. The last part
of the example prints the original array of characters, but this time
using the <tt class="literal"><span class="pre">make_indirect_iterator</span></tt> helper function.</p>
<pre class="literal-block"> <pre class="literal-block">
char characters[] = &quot;abcdefg&quot;; char characters[] = &quot;abcdefg&quot;;
const int N = sizeof(characters)/sizeof(char) - 1; // -1 since characters has a null char const int N = sizeof(characters)/sizeof(char) - 1; // -1 since characters has a null char
@ -262,5 +311,11 @@ a,b,c,d,e,f,g,
</pre> </pre>
</div> </div>
</div> </div>
<hr class="footer"/>
<div class="footer">
<a class="reference" href="indirect_iterator.rst">View document source</a>.
Generated on: 2004-01-12 15:51 UTC.
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
</body> </body>
</html> </html>

View File

@ -20,5 +20,8 @@
.. contents:: Table of Contents .. contents:: Table of Contents
``indirect_iterator`` synopsis
..............................
.. include:: indirect_iterator_ref.rst .. include:: indirect_iterator_ref.rst
.. include:: indirect_iterator_eg.rst .. include:: indirect_iterator_eg.rst

View File

@ -1,6 +1,15 @@
Example Example
....... .......
This example prints an array of characters, using
``indirect_iterator`` to access the array of characters through an
array of pointers. Next ``indirect_iterator`` is used with the
``transform`` algorithm to copy the characters (incremented by one) to
another array. A constant indirect iterator is used for the source and
a mutable indirect iterator is used for the destination. The last part
of the example prints the original array of characters, but this time
using the ``make_indirect_iterator`` helper function.
:: ::
@ -52,3 +61,4 @@ The output is::
a,b,c,d,e,f,g, a,b,c,d,e,f,g,
b,c,d,e,f,g,h, b,c,d,e,f,g,h,
a,b,c,d,e,f,g, a,b,c,d,e,f,g,

View File

@ -31,6 +31,9 @@
); );
Iterator base() const; Iterator base() const;
reference operator*() const;
indirect_iterator& operator++();
indirect_iterator& operator--();
private: private:
Iterator m_iterator; // exposition Iterator m_iterator; // exposition
}; };
@ -108,6 +111,11 @@ the ``Iterator`` argument.
``indirect_iterator`` operations ``indirect_iterator`` operations
................................ ................................
In addition to the operations required by the concepts modeled by
``indirect_iterator``, ``indirect_iterator`` provides the following
operations.
``indirect_iterator();`` ``indirect_iterator();``
:Requires: ``Iterator`` must be Default Constructible. :Requires: ``Iterator`` must be Default Constructible.
@ -141,3 +149,20 @@ the ``Iterator`` argument.
``Iterator base() const;`` ``Iterator base() const;``
:Returns: ``m_iterator`` :Returns: ``m_iterator``
``reference operator*() const;``
:Returns: ``**m_iterator``
``indirect_iterator& operator++();``
:Effects: ``++m_iterator``
:Returns: ``*this``
``indirect_iterator& operator--();``
:Effects: ``--m_iterator``
:Returns: ``*this``

View File

@ -47,14 +47,12 @@ invoking <tt class="literal"><span class="pre">operator--()</span></tt> moves th
<div class="contents topic" id="table-of-contents"> <div class="contents topic" id="table-of-contents">
<p class="topic-title"><a name="table-of-contents">Table of Contents</a></p> <p class="topic-title"><a name="table-of-contents">Table of Contents</a></p>
<ul class="simple"> <ul class="simple">
<li><a class="reference" href="#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-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-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-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-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="#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> <li><a class="reference" href="#example" id="id5" name="id5">Example</a></li>
</ul> </ul>
</li>
</ul>
</div> </div>
<div class="section" id="reverse-iterator-synopsis"> <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> <h1><a class="toc-backref" href="#id1" name="reverse-iterator-synopsis"><tt class="literal"><span class="pre">reverse_iterator</span></tt> synopsis</a></h1>
@ -74,24 +72,29 @@ public:
Iterator base() const; Iterator base() const;
reference operator*() const; reference operator*() const;
reverse_iterator&amp; operator++(); reverse_iterator&amp; operator++();
reverse_iterator&amp; operator--();
private: private:
Iterator m_iterator; // exposition Iterator m_iterator; // exposition
}; };
</pre> </pre>
</div>
<div class="section" id="reverse-iterator-requirements"> <div class="section" id="reverse-iterator-requirements">
<h2><a class="toc-backref" href="#id2" name="reverse-iterator-requirements"><tt class="literal"><span class="pre">reverse_iterator</span></tt> requirements</a></h2> <h1><a class="toc-backref" href="#id2" name="reverse-iterator-requirements"><tt class="literal"><span class="pre">reverse_iterator</span></tt> requirements</a></h1>
<p>The base <tt class="literal"><span class="pre">Iterator</span></tt> must be a model of Bidirectional Traversal <p>The base <tt class="literal"><span class="pre">Iterator</span></tt> must be a model of Bidirectional Traversal
Iterator and Readable Iterator.</p> Iterator and Readable Iterator.</p>
</div> </div>
<div class="section" id="reverse-iterator-models"> <div class="section" id="reverse-iterator-models">
<h2><a class="toc-backref" href="#id3" name="reverse-iterator-models"><tt class="literal"><span class="pre">reverse_iterator</span></tt> models</a></h2> <h1><a class="toc-backref" href="#id3" name="reverse-iterator-models"><tt class="literal"><span class="pre">reverse_iterator</span></tt> models</a></h1>
<p><tt class="literal"><span class="pre">reverse_iterator</span></tt> models Bidirectional Traversal Iterator and <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 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> standard iterator access concepts that the <tt class="literal"><span class="pre">Iterator</span></tt>
argument models.</p> argument models.</p>
</div> </div>
<div class="section" id="reverse-iterator-operations"> <div class="section" id="reverse-iterator-operations">
<h2><a class="toc-backref" href="#id4" name="reverse-iterator-operations"><tt class="literal"><span class="pre">reverse_iterator</span></tt> operations</a></h2> <h1><a class="toc-backref" href="#id4" name="reverse-iterator-operations"><tt class="literal"><span class="pre">reverse_iterator</span></tt> operations</a></h1>
<p>In addition to the operations required by the concepts modeled by
<tt class="literal"><span class="pre">reverse_iterator</span></tt>, <tt class="literal"><span class="pre">reverse_iterator</span></tt> provides the following
operations.</p>
<p><tt class="literal"><span class="pre">reverse_iterator();</span></tt></p> <p><tt class="literal"><span class="pre">reverse_iterator();</span></tt></p>
<table class="field-list" frame="void" rules="none"> <table class="field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
@ -164,6 +167,17 @@ return *..tmp;
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p><tt class="literal"><span class="pre">reverse_iterator&amp;</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">++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>
</tbody>
</table>
<pre class="literal-block"> <pre class="literal-block">
template &lt;class BidirectionalIterator&gt; template &lt;class BidirectionalIterator&gt;
reverse_iterator&lt;BidirectionalIterator&gt;n reverse_iterator&lt;BidirectionalIterator&gt;n
@ -180,7 +194,7 @@ with a <tt class="literal"><span class="pre">current</span></tt> constructed fro
</table> </table>
</div> </div>
<div class="section" id="example"> <div class="section" id="example">
<h2><a class="toc-backref" href="#id5" name="example">Example</a></h2> <h1><a class="toc-backref" href="#id5" name="example">Example</a></h1>
<p>The following example prints an array of characters in reverse order <p>The following example prints an array of characters in reverse order
using <tt class="literal"><span class="pre">reverse_iterator</span></tt>.</p> using <tt class="literal"><span class="pre">reverse_iterator</span></tt>.</p>
<pre class="literal-block"> <pre class="literal-block">
@ -213,6 +227,11 @@ sequence in double-reversed (normal) order: hello world!
</pre> </pre>
</div> </div>
</div> </div>
<hr class="footer"/>
<div class="footer">
<a class="reference" href="reverse_iterator.rst">View document source</a>.
Generated on: 2004-01-12 15:45 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> </div>
</body> </body>
</html> </html>

View File

@ -21,7 +21,7 @@
.. contents:: Table of Contents .. contents:: Table of Contents
``reverse_iterator`` synopsis ``reverse_iterator`` synopsis
----------------------------- .............................
.. include:: reverse_iterator_ref.rst .. include:: reverse_iterator_ref.rst
.. include:: make_reverse_iterator.rst .. include:: make_reverse_iterator.rst

View File

@ -15,6 +15,7 @@
Iterator base() const; Iterator base() const;
reference operator*() const; reference operator*() const;
reverse_iterator& operator++(); reverse_iterator& operator++();
reverse_iterator& operator--();
private: private:
Iterator m_iterator; // exposition Iterator m_iterator; // exposition
}; };
@ -40,6 +41,12 @@ argument models.
``reverse_iterator`` operations ``reverse_iterator`` operations
............................... ...............................
In addition to the operations required by the concepts modeled by
``reverse_iterator``, ``reverse_iterator`` provides the following
operations.
``reverse_iterator();`` ``reverse_iterator();``
:Requires: ``Iterator`` must be Default Constructible. :Requires: ``Iterator`` must be Default Constructible.
@ -85,3 +92,9 @@ argument models.
:Effects: ``--m_iterator`` :Effects: ``--m_iterator``
:Returns: ``*this`` :Returns: ``*this``
``reverse_iterator& operator--();``
:Effects: ``++m_iterator``
:Returns: ``*this``

View File

@ -48,12 +48,15 @@ then returns the result.</p>
<div class="contents topic" id="table-of-contents"> <div class="contents topic" id="table-of-contents">
<p class="topic-title"><a name="table-of-contents">Table of Contents</a></p> <p class="topic-title"><a name="table-of-contents">Table of Contents</a></p>
<ul class="simple"> <ul class="simple">
<li><a class="reference" href="#transform-iterator-requirements" id="id1" name="id1"><tt class="literal"><span class="pre">transform_iterator</span></tt> requirements</a></li> <li><a class="reference" href="#transform-iterator-synopsis" id="id1" name="id1"><tt class="literal"><span class="pre">transform_iterator</span></tt> synopsis</a></li>
<li><a class="reference" href="#transform-iterator-models" id="id2" name="id2"><tt class="literal"><span class="pre">transform_iterator</span></tt> models</a></li> <li><a class="reference" href="#transform-iterator-requirements" id="id2" name="id2"><tt class="literal"><span class="pre">transform_iterator</span></tt> requirements</a></li>
<li><a class="reference" href="#transform-iterator-operations" id="id3" name="id3"><tt class="literal"><span class="pre">transform_iterator</span></tt> operations</a></li> <li><a class="reference" href="#transform-iterator-models" id="id3" name="id3"><tt class="literal"><span class="pre">transform_iterator</span></tt> models</a></li>
<li><a class="reference" href="#example" id="id4" name="id4">Example</a></li> <li><a class="reference" href="#transform-iterator-operations" id="id4" name="id4"><tt class="literal"><span class="pre">transform_iterator</span></tt> operations</a></li>
<li><a class="reference" href="#example" id="id5" name="id5">Example</a></li>
</ul> </ul>
</div> </div>
<div class="section" id="transform-iterator-synopsis">
<h1><a class="toc-backref" href="#id1" name="transform-iterator-synopsis"><tt class="literal"><span class="pre">transform_iterator</span></tt> synopsis</a></h1>
<!-- Version 1.3 of this document was accepted for TR1 --> <!-- Version 1.3 of this document was accepted for TR1 -->
<pre class="literal-block"> <pre class="literal-block">
template &lt;class UnaryFunction, template &lt;class UnaryFunction,
@ -72,18 +75,19 @@ public:
, typename enable_if_convertible&lt;I2, Iterator&gt;::type* = 0 // exposition , typename enable_if_convertible&lt;I2, Iterator&gt;::type* = 0 // exposition
, typename enable_if_convertible&lt;F2, UnaryFunction&gt;::type* = 0 // exposition , typename enable_if_convertible&lt;F2, UnaryFunction&gt;::type* = 0 // exposition
); );
reference operator*() const;
transform_iterator&amp; operator++();
Iterator base() const; Iterator base() const;
UnaryFunction functor() const; UnaryFunction functor() const;
reference operator*() const;
transform_iterator&amp; operator++();
transform_iterator&amp; operator--();
private: private:
Iterator m_iterator; // exposition Iterator m_iterator; // exposition
UnaryFunction m_f; // exposition UnaryFunction m_f; // exposition
}; };
</pre> </pre>
</div>
<div class="section" id="transform-iterator-requirements"> <div class="section" id="transform-iterator-requirements">
<h1><a class="toc-backref" href="#id1" name="transform-iterator-requirements"><tt class="literal"><span class="pre">transform_iterator</span></tt> requirements</a></h1> <h1><a class="toc-backref" href="#id2" name="transform-iterator-requirements"><tt class="literal"><span class="pre">transform_iterator</span></tt> requirements</a></h1>
<p>The type <tt class="literal"><span class="pre">UnaryFunction</span></tt> must be Assignable, Copy Constructible, and <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 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 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
@ -92,7 +96,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> <p>The type <tt class="literal"><span class="pre">Iterator</span></tt> must at least model Readable Iterator.</p>
</div> </div>
<div class="section" id="transform-iterator-models"> <div class="section" id="transform-iterator-models">
<h1><a class="toc-backref" href="#id2" name="transform-iterator-models"><tt class="literal"><span class="pre">transform_iterator</span></tt> models</a></h1> <h1><a class="toc-backref" href="#id3" name="transform-iterator-models"><tt class="literal"><span class="pre">transform_iterator</span></tt> models</a></h1>
<p>The resulting <tt class="literal"><span class="pre">transform_iterator</span></tt> models the most refined of the <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> following options that is also modeled by <tt class="literal"><span class="pre">Iterator</span></tt>.</p>
<blockquote> <blockquote>
@ -110,7 +114,10 @@ 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&lt;remove_reference&lt;reference&gt;</span> <span class="pre">&gt;::type</span></tt>.</p> The <tt class="literal"><span class="pre">value_type</span></tt> is <tt class="literal"><span class="pre">remove_cv&lt;remove_reference&lt;reference&gt;</span> <span class="pre">&gt;::type</span></tt>.</p>
</div> </div>
<div class="section" id="transform-iterator-operations"> <div class="section" id="transform-iterator-operations">
<h1><a class="toc-backref" href="#id3" name="transform-iterator-operations"><tt class="literal"><span class="pre">transform_iterator</span></tt> operations</a></h1> <h1><a class="toc-backref" href="#id4" name="transform-iterator-operations"><tt class="literal"><span class="pre">transform_iterator</span></tt> operations</a></h1>
<p>In addition to the operations required by the concepts modeled by
<tt class="literal"><span class="pre">transform_iterator</span></tt>, <tt class="literal"><span class="pre">transform_iterator</span></tt> provides the following
operations.</p>
<p><tt class="literal"><span class="pre">transform_iterator();</span></tt></p> <p><tt class="literal"><span class="pre">transform_iterator();</span></tt></p>
<table class="field-list" frame="void" rules="none"> <table class="field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
@ -186,6 +193,17 @@ transform_iterator(
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p><tt class="literal"><span class="pre">transform_iterator&amp;</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">--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>
</tbody>
</table>
<pre class="literal-block"> <pre class="literal-block">
template &lt;class UnaryFunction, class Iterator&gt; template &lt;class UnaryFunction, class Iterator&gt;
transform_iterator&lt;UnaryFunction, Iterator&gt; transform_iterator&lt;UnaryFunction, Iterator&gt;
@ -216,7 +234,7 @@ default constructed and <tt class="literal"><span class="pre">m_iterator</span><
</table> </table>
</div> </div>
<div class="section" id="example"> <div class="section" id="example">
<h1><a class="toc-backref" href="#id4" name="example">Example</a></h1> <h1><a class="toc-backref" href="#id5" name="example">Example</a></h1>
<p>This is a simple example of using the transform_iterators class to <p>This is a simple example of using the transform_iterators class to
generate iterators that multiply (or add to) the value returned by generate iterators that multiply (or add to) the value returned by
dereferencing the iterator. It would be cooler to use lambda library dereferencing the iterator. It would be cooler to use lambda library
@ -254,7 +272,7 @@ adding 4 to each element in the array:
<hr class="footer"/> <hr class="footer"/>
<div class="footer"> <div class="footer">
<a class="reference" href="transform_iterator.rst">View document source</a>. <a class="reference" href="transform_iterator.rst">View document source</a>.
Generated on: 2004-01-12 15:20 UTC. Generated on: 2004-01-12 15: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. 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> </div>
</body> </body>

View File

@ -20,6 +20,9 @@
.. contents:: Table of Contents .. contents:: Table of Contents
``transform_iterator`` synopsis
...............................
.. include:: transform_iterator_ref.rst .. include:: transform_iterator_ref.rst
.. include:: make_transform_iterator.rst .. include:: make_transform_iterator.rst
.. include:: transform_iterator_eg.rst .. include:: transform_iterator_eg.rst

View File

@ -18,11 +18,11 @@
, typename enable_if_convertible<I2, Iterator>::type* = 0 // exposition , typename enable_if_convertible<I2, Iterator>::type* = 0 // exposition
, typename enable_if_convertible<F2, UnaryFunction>::type* = 0 // exposition , typename enable_if_convertible<F2, UnaryFunction>::type* = 0 // exposition
); );
reference operator*() const;
transform_iterator& operator++();
Iterator base() const; Iterator base() const;
UnaryFunction functor() const; UnaryFunction functor() const;
reference operator*() const;
transform_iterator& operator++();
transform_iterator& operator--();
private: private:
Iterator m_iterator; // exposition Iterator m_iterator; // exposition
UnaryFunction m_f; // exposition UnaryFunction m_f; // exposition
@ -66,6 +66,11 @@ The ``value_type`` is ``remove_cv<remove_reference<reference> >::type``.
``transform_iterator`` operations ``transform_iterator`` operations
................................. .................................
In addition to the operations required by the concepts modeled by
``transform_iterator``, ``transform_iterator`` provides the following
operations.
``transform_iterator();`` ``transform_iterator();``
:Returns: An instance of ``transform_iterator`` with ``m_f`` :Returns: An instance of ``transform_iterator`` with ``m_f``
@ -110,3 +115,9 @@ The ``value_type`` is ``remove_cv<remove_reference<reference> >::type``.
:Effects: ``++m_iterator`` :Effects: ``++m_iterator``
:Returns: ``*this`` :Returns: ``*this``
``transform_iterator& operator--();``
:Effects: ``--m_iterator``
:Returns: ``*this``