[SVN r21577]
This commit is contained in:
Dave Abrahams 2004-01-10 19:00:48 +00:00
parent c903cf4801
commit dd5fb425fa
7 changed files with 479 additions and 196 deletions

View File

@ -3,12 +3,203 @@
<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.2.8: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
<title>Iterator Facade and Adaptor</title> <title>Iterator Facade and Adaptor</title>
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" /> <meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" /> <meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
<meta name="date" content="2003-11-24" /> <meta name="date" content="2003-11-24" />
<link rel="stylesheet" href="default.css" type="text/css" /> <style type="text/css"><!--
/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:date: $Date$
:version: $Revision$
:copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
*/
.first {
margin-top: 0 }
.last {
margin-bottom: 0 }
a.toc-backref {
text-decoration: none ;
color: black }
dd {
margin-bottom: 0.5em }
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.attention, div.caution, div.danger, div.error, div.hint,
div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
color: red ;
font-weight: bold ;
font-family: sans-serif }
div.hint p.admonition-title, div.important p.admonition-title,
div.note p.admonition-title, div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em }
div.footer, div.header {
font-size: smaller }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr {
width: 75% }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font-family: serif ;
font-size: 100% }
pre.line-block {
font-family: serif ;
font-size: 100% }
pre.literal-block, pre.doctest-block {
margin-left: 2em ;
margin-right: 2em ;
background-color: #eeeeee }
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option-argument {
font-style: italic }
span.pre {
white-space: pre }
span.problematic {
color: red }
table {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.citation {
border-left: solid thin gray ;
padding-left: 0.5ex }
table.docinfo {
margin: 2em 4em }
table.footnote {
border-left: solid thin black ;
padding-left: 0.5ex }
td, th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
th.docinfo-name, th.field-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap }
h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
font-size: 100% }
tt {
background-color: #eeeeee }
ul.auto-toc {
list-style-type: none }
--></style>
</head> </head>
<body> <body>
<div class="document" id="iterator-facade-and-adaptor"> <div class="document" id="iterator-facade-and-adaptor">
@ -96,40 +287,41 @@ by adapting other iterators.</td>
<li><a class="reference" href="#indirect-iterator" id="id40" name="id40">Indirect iterator</a><ul> <li><a class="reference" href="#indirect-iterator" id="id40" name="id40">Indirect iterator</a><ul>
<li><a class="reference" href="#class-template-indirect-iterator" id="id41" name="id41">Class template <tt class="literal"><span class="pre">indirect_iterator</span></tt></a></li> <li><a class="reference" href="#class-template-indirect-iterator" id="id41" name="id41">Class template <tt class="literal"><span class="pre">indirect_iterator</span></tt></a></li>
<li><a class="reference" href="#indirect-iterator-requirements" id="id42" name="id42"><tt class="literal"><span class="pre">indirect_iterator</span></tt> requirements</a></li> <li><a class="reference" href="#indirect-iterator-requirements" id="id42" name="id42"><tt class="literal"><span class="pre">indirect_iterator</span></tt> requirements</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> <li><a class="reference" href="#indirect-iterator-models" id="id43" name="id43"><tt class="literal"><span class="pre">indirect_iterator</span></tt> models</a></li>
<li><a class="reference" href="#indirect-iterator-operations" id="id44" name="id44"><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="id44" name="id44">Reverse iterator</a><ul> <li><a class="reference" href="#reverse-iterator" id="id45" name="id45">Reverse iterator</a><ul>
<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="#class-template-reverse-iterator" id="id46" name="id46">Class template <tt class="literal"><span class="pre">reverse_iterator</span></tt></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-requirements" id="id47" name="id47"><tt class="literal"><span class="pre">reverse_iterator</span></tt> requirements</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference" href="#transform-iterator" id="id47" name="id47">Transform iterator</a><ul> <li><a class="reference" href="#transform-iterator" id="id48" name="id48">Transform iterator</a><ul>
<li><a class="reference" href="#class-template-transform-iterator" id="id48" name="id48">Class template <tt class="literal"><span class="pre">transform_iterator</span></tt></a></li> <li><a class="reference" href="#class-template-transform-iterator" id="id49" name="id49">Class template <tt class="literal"><span class="pre">transform_iterator</span></tt></a></li>
<li><a class="reference" href="#transform-iterator-requirements" id="id49" name="id49"><tt class="literal"><span class="pre">transform_iterator</span></tt> requirements</a></li> <li><a class="reference" href="#transform-iterator-requirements" id="id50" name="id50"><tt class="literal"><span class="pre">transform_iterator</span></tt> requirements</a></li>
<li><a class="reference" href="#transform-iterator-public-operations" id="id50" name="id50"><tt class="literal"><span class="pre">transform_iterator</span></tt> public operations</a></li> <li><a class="reference" href="#transform-iterator-public-operations" id="id51" name="id51"><tt class="literal"><span class="pre">transform_iterator</span></tt> public operations</a></li>
<li><a class="reference" href="#transform-iterator-private-operations" id="id51" name="id51"><tt class="literal"><span class="pre">transform_iterator</span></tt> private operations</a></li> <li><a class="reference" href="#transform-iterator-private-operations" id="id52" name="id52"><tt class="literal"><span class="pre">transform_iterator</span></tt> private operations</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference" href="#filter-iterator" id="id52" name="id52">Filter iterator</a><ul> <li><a class="reference" href="#filter-iterator" id="id53" name="id53">Filter iterator</a><ul>
<li><a class="reference" href="#class-template-filter-iterator" id="id53" name="id53">Class template <tt class="literal"><span class="pre">filter_iterator</span></tt></a></li> <li><a class="reference" href="#class-template-filter-iterator" id="id54" name="id54">Class template <tt class="literal"><span class="pre">filter_iterator</span></tt></a></li>
</ul> </ul>
</li> </li>
<li><a class="reference" href="#filter-iterator-requirements" id="id54" name="id54"><tt class="literal"><span class="pre">filter_iterator</span></tt> requirements</a></li> <li><a class="reference" href="#filter-iterator-requirements" id="id55" name="id55"><tt class="literal"><span class="pre">filter_iterator</span></tt> requirements</a></li>
<li><a class="reference" href="#filter-iterator-operations" id="id55" name="id55"><tt class="literal"><span class="pre">filter_iterator</span></tt> operations</a></li> <li><a class="reference" href="#filter-iterator-operations" id="id56" name="id56"><tt class="literal"><span class="pre">filter_iterator</span></tt> operations</a></li>
<li><a class="reference" href="#counting-iterator" id="id56" name="id56">Counting iterator</a><ul> <li><a class="reference" href="#counting-iterator" id="id57" name="id57">Counting iterator</a><ul>
<li><a class="reference" href="#class-template-counting-iterator" id="id57" name="id57">Class template <tt class="literal"><span class="pre">counting_iterator</span></tt></a></li> <li><a class="reference" href="#class-template-counting-iterator" id="id58" name="id58">Class template <tt class="literal"><span class="pre">counting_iterator</span></tt></a></li>
</ul> </ul>
</li> </li>
<li><a class="reference" href="#counting-iterator-requirements" id="id58" name="id58"><tt class="literal"><span class="pre">counting_iterator</span></tt> requirements</a></li> <li><a class="reference" href="#counting-iterator-requirements" id="id59" name="id59"><tt class="literal"><span class="pre">counting_iterator</span></tt> requirements</a></li>
<li><a class="reference" href="#counting-iterator-operations" id="id59" name="id59"><tt class="literal"><span class="pre">counting_iterator</span></tt> operations</a></li> <li><a class="reference" href="#counting-iterator-operations" id="id60" name="id60"><tt class="literal"><span class="pre">counting_iterator</span></tt> operations</a></li>
<li><a class="reference" href="#function-output-iterator" id="id60" name="id60">Function output iterator</a><ul> <li><a class="reference" href="#function-output-iterator" id="id61" name="id61">Function output iterator</a><ul>
<li><a class="reference" href="#class-template-function-output-iterator" id="id61" name="id61">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="id62" name="id62">Class template <tt class="literal"><span class="pre">function_output_iterator</span></tt></a></li>
</ul> </ul>
</li> </li>
<li><a class="reference" href="#function-output-iterator-requirements" id="id62" name="id62"><tt class="literal"><span class="pre">function_output_iterator</span></tt> requirements</a></li> <li><a class="reference" href="#function-output-iterator-requirements" id="id63" name="id63"><tt class="literal"><span class="pre">function_output_iterator</span></tt> requirements</a></li>
<li><a class="reference" href="#function-output-iterator-operations" id="id63" name="id63"><tt class="literal"><span class="pre">function_output_iterator</span></tt> operations</a></li> <li><a class="reference" href="#function-output-iterator-operations" id="id64" name="id64"><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="id64" name="id64"><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="id65" name="id65"><tt class="literal"><span class="pre">function_output_iterator::output_proxy</span></tt> operations</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -304,14 +496,15 @@ impossible.</li>
</blockquote> </blockquote>
<div class="section" id="usage"> <div class="section" id="usage">
<h3><a class="toc-backref" href="#id19" 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 an <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> which takes the derived iterator specialization of <tt class="literal"><span class="pre">iterator_facade</span></tt> and passes the derived
class as the first template parameter. The order of the other iterator class as <tt class="literal"><span class="pre">iterator_facade</span></tt>'s first template parameter.
template parameters to <tt class="literal"><span class="pre">iterator_facade</span></tt> have been carefully chosen The order of the other template parameters have been carefully
to take advantage of useful defaults. For example, when defining a chosen to take advantage of useful defaults. For example, when
constant lvalue iterator, the user can pass a const-qualified version defining a constant lvalue iterator, the user can pass a
of the iterator's <tt class="literal"><span class="pre">value_type</span></tt> as <tt class="literal"><span class="pre">iterator_facade</span></tt>'s <tt class="literal"><span class="pre">Value</span></tt> const-qualified version of the iterator's <tt class="literal"><span class="pre">value_type</span></tt> as
parameter and omit the <tt class="literal"><span class="pre">Reference</span></tt> parameter which follows.</p> <tt class="literal"><span class="pre">iterator_facade</span></tt>'s <tt class="literal"><span class="pre">Value</span></tt> parameter and omit the
<tt class="literal"><span class="pre">Reference</span></tt> parameter which follows.</p>
<p>The derived iterator class must define member functions implementing <p>The derived iterator class must define member functions implementing
the iterator's core behaviors. The following table describes the iterator's core behaviors. The following table describes
expressions which are required to be valid depending on the category expressions which are required to be valid depending on the category
@ -319,7 +512,7 @@ of the derived iterator type. These member functions are described
briefly below and in more detail in the iterator facade briefly below and in more detail in the iterator facade
requirements.</p> requirements.</p>
<blockquote> <blockquote>
<table class="table" frame="border" rules="all"> <table border class="table">
<colgroup> <colgroup>
<col width="44%" /> <col width="44%" />
<col width="56%" /> <col width="56%" />
@ -712,7 +905,7 @@ object of type <tt class="literal"><span class="pre">X</span></tt>, <tt class="l
object of a single pass iterator type interoperable with <tt class="literal"><span class="pre">X</span></tt>, and <tt class="literal"><span class="pre">z</span></tt> object of a single pass iterator type interoperable with <tt class="literal"><span class="pre">X</span></tt>, and <tt class="literal"><span class="pre">z</span></tt>
is a constant object of a random access traversal iterator type is a constant object of a random access traversal iterator type
interoperable with <tt class="literal"><span class="pre">X</span></tt>.</p> interoperable with <tt class="literal"><span class="pre">X</span></tt>.</p>
<table class="table" frame="border" rules="all"> <table border class="table">
<colgroup> <colgroup>
<col width="19%" /> <col width="19%" />
<col width="21%" /> <col width="21%" />
@ -1256,17 +1449,14 @@ template &lt;
, class Difference = use_default , class Difference = use_default
&gt; &gt;
class indirect_iterator class indirect_iterator
: public iterator_adaptor&lt;
indirect_iterator&lt;Iterator, Value, Access, Traversal,
Reference, Difference&gt;,
Iterator,
/* Value = see below */,
CategoryOrTraversal,
Reference,
Difference&gt;
{ {
friend class iterator_core_access;
public: public:
typedef /* see below */ value_type;
typedef /* see below */ reference;
typedef /* see below */ pointer;
typedef /* see below */ difference_type;
typedef /* see below */ iterator_category;
indirect_iterator(); indirect_iterator();
indirect_iterator(Iterator x); indirect_iterator(Iterator x);
@ -1280,54 +1470,71 @@ class indirect_iterator
&gt; const&amp; y &gt; const&amp; y
, typename enable_if_convertible&lt;Iterator2, Iterator&gt;::type* = 0 // exposition , typename enable_if_convertible&lt;Iterator2, Iterator&gt;::type* = 0 // exposition
); );
private: // as-if specification
typename indirect_iterator::reference dereference() const
{
return **this-&gt;base();
}
}; };
</pre>
<p>The member types of <tt class="literal"><span class="pre">indirect_iterator</span></tt> are defined according to the
following pseudo-code. We use the abbreviation
<tt class="literal"><span class="pre">V=iterator_traits&lt;Iterator&gt;::value_type</span></tt>.:</p>
<pre class="literal-block">
if (Value is use_default) then
typedef iterator_traits&lt;V&gt;::value_type value_type;
else
typedef remove_const&lt;Value&gt;::type value_type;
template &lt;class Dereferenceable&gt; if (Reference is use_default) then
struct referent { if (Value is use_default) then
typedef /* see below */ type; typedef iterator_traits&lt;V&gt;::reference reference;
}; else
</pre> typedef Value&amp; reference;
<p>If <tt class="literal"><span class="pre">Value</span></tt> is not <tt class="literal"><span class="pre">use_default</span></tt> then the the argument for the
<tt class="literal"><span class="pre">iterator_adaptor</span></tt> base class' <tt class="literal"><span class="pre">Value</span></tt> parameter is <tt class="literal"><span class="pre">Value</span></tt> with
cv-qualifiers removed. If <tt class="literal"><span class="pre">Value</span></tt> is <tt class="literal"><span class="pre">use_default</span></tt>, then the
argument for the <tt class="literal"><span class="pre">iterator_adaptor</span></tt> base class' <tt class="literal"><span class="pre">Value</span></tt> parameter
is computed as follows. We use the abbreviation
<tt class="literal"><span class="pre">V=iterator_traits&lt;Iterator&gt;::value_type</span></tt> and <tt class="literal"><span class="pre">v</span></tt> is an object of
type <tt class="literal"><span class="pre">V</span></tt>.:</p>
<pre class="literal-block">
if (*v returns a constant lvalue or an rvalue) then
referent&lt;V&gt;::type
else else
add_const&lt;referent&lt;V&gt;::type&gt;::type typedef Reference reference;
</pre>
<p>The algorithm for the <tt class="literal"><span class="pre">type</span></tt> member of <tt class="literal"><span class="pre">referent</span></tt> traits class is if (Value is use_default) then
as follows:</p> typedef ?? pointer;
<pre class="literal-block">
if (Dereferenceable is a class and has member element_type)
Dereferenceable::element_type
else else
iterator_traits&lt;Dereferenceable&gt;::value_type typedef Value* pointer;
if (Difference is use_default)
typedef iterator_traits&lt;Iterator&gt;::difference_type difference_type;
else
typedef Difference difference_type;
</pre> </pre>
<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
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="#id42" name="indirect-iterator-requirements"><tt class="literal"><span class="pre">indirect_iterator</span></tt> requirements</a></h4> <h4><a class="toc-backref" href="#id42" 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> type must meet the requirements of Readable <p>The <tt class="literal"><span class="pre">Iterator</span></tt> argument shall meet the requirements of Readable
Iterator. Also, the following requirements are placed on Iterator. The <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> argument shall be one of the
<tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt>. Let <tt class="literal"><span class="pre">i</span></tt> be an object of standard iterator tags or <tt class="literal"><span class="pre">use_default</span></tt>. If <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt>
type <tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt>. Then <tt class="literal"><span class="pre">*i</span></tt> must be a is an iterator tag, the template parameter <tt class="literal"><span class="pre">Iterator</span></tt> argument shall
valid expression, and the type of <tt class="literal"><span class="pre">*i</span></tt> must be the same as the meet the traversal requirements corresponding to the iterator tag.</p>
<tt class="literal"><span class="pre">iterator_adaptor::reference</span></tt>. Also, there are further requirements <p>The expression <tt class="literal"><span class="pre">*v</span></tt>, where <tt class="literal"><span class="pre">v</span></tt> is an object of type
on the <tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt> if the <tt class="literal"><span class="pre">Value</span></tt> <tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt>, must be a valid expression
parameter is not <tt class="literal"><span class="pre">use_default</span></tt>, as implied by the algorithm for deducing and must be convertible to <tt class="literal"><span class="pre">indirect_iterator::reference</span></tt>. Also
the default.</p> <tt class="literal"><span class="pre">indirect_iterator::reference</span></tt> must be convertible to
<tt class="literal"><span class="pre">indirect_iterator::value</span></tt>. There are further requirements on the
<tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt> if the <tt class="literal"><span class="pre">Value</span></tt> parameter
is not <tt class="literal"><span class="pre">use_default</span></tt>, as implied by the algorithm for deducing the
default for the <tt class="literal"><span class="pre">value_type</span></tt> member.</p>
</div>
<div class="section" id="indirect-iterator-models">
<h4><a class="toc-backref" href="#id43" 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,
<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
of the most refined standard traversal concept that is satisfied by
the <tt class="literal"><span class="pre">Iterator</span></tt> argument.</p>
<p><tt class="literal"><span class="pre">indirect_iterator</span></tt> models Readable Iterator. If
<tt class="literal"><span class="pre">indirect_iterator::reference(*v)</span> <span class="pre">=</span> <span class="pre">t</span></tt> is a valid expression (where
<tt class="literal"><span class="pre">t</span></tt> is an object of type <tt class="literal"><span class="pre">indirect_iterator::value_type</span></tt>) then
<tt class="literal"><span class="pre">indirect_iterator</span></tt> models Writable Iterator. If
<tt class="literal"><span class="pre">indirect_iterator::reference</span></tt> is a reference then
<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="#id43" name="indirect-iterator-operations"><tt class="literal"><span class="pre">indirect_iterator</span></tt> operations</a></h4> <h4><a class="toc-backref" href="#id44" name="indirect-iterator-operations"><tt class="literal"><span class="pre">indirect_iterator</span></tt> operations</a></h4>
<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" />
@ -1376,13 +1583,13 @@ indirect_iterator(
</div> </div>
</div> </div>
<div class="section" id="reverse-iterator"> <div class="section" id="reverse-iterator">
<h3><a class="toc-backref" href="#id44" name="reverse-iterator">Reverse iterator</a></h3> <h3><a class="toc-backref" href="#id45" 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="#id45" 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="#id46" 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 :
@ -1421,7 +1628,7 @@ private: // as-if specification
</pre> </pre>
</div> </div>
<div class="section" id="reverse-iterator-requirements"> <div class="section" id="reverse-iterator-requirements">
<h4><a class="toc-backref" href="#id46" name="reverse-iterator-requirements"><tt class="literal"><span class="pre">reverse_iterator</span></tt> requirements</a></h4> <h4><a class="toc-backref" href="#id47" 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. The resulting <tt class="literal"><span class="pre">reverse_iterator</span></tt> will be a model of the Iterator. The resulting <tt class="literal"><span class="pre">reverse_iterator</span></tt> will be a model of the
most refined standard traversal and access concepts that are modeled most refined standard traversal and access concepts that are modeled
@ -1468,14 +1675,14 @@ reverse_iterator(
</div> </div>
</div> </div>
<div class="section" id="transform-iterator"> <div class="section" id="transform-iterator">
<h3><a class="toc-backref" href="#id47" name="transform-iterator">Transform iterator</a></h3> <h3><a class="toc-backref" href="#id48" 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="#id48" 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="#id49" 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,
@ -1505,7 +1712,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="#id49" name="transform-iterator-requirements"><tt class="literal"><span class="pre">transform_iterator</span></tt> requirements</a></h4> <h4><a class="toc-backref" href="#id50" 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
@ -1529,7 +1736,7 @@ concept that is modeled by <tt class="literal"><span class="pre">Iterator</span>
The <tt class="literal"><span class="pre">value_type</span></tt> is <tt class="literal"><span class="pre">remove_cv&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-public-operations"> <div class="section" id="transform-iterator-public-operations">
<h4><a class="toc-backref" href="#id50" name="transform-iterator-public-operations"><tt class="literal"><span class="pre">transform_iterator</span></tt> public operations</a></h4> <h4><a class="toc-backref" href="#id51" name="transform-iterator-public-operations"><tt class="literal"><span class="pre">transform_iterator</span></tt> public operations</a></h4>
<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" />
@ -1578,7 +1785,7 @@ transform_iterator(
</table> </table>
</div> </div>
<div class="section" id="transform-iterator-private-operations"> <div class="section" id="transform-iterator-private-operations">
<h4><a class="toc-backref" href="#id51" name="transform-iterator-private-operations"><tt class="literal"><span class="pre">transform_iterator</span></tt> private operations</a></h4> <h4><a class="toc-backref" href="#id52" name="transform-iterator-private-operations"><tt class="literal"><span class="pre">transform_iterator</span></tt> private operations</a></h4>
<p><tt class="literal"><span class="pre">typename</span> <span class="pre">transform_iterator::value_type</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">transform_iterator::value_type</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" />
@ -1591,7 +1798,7 @@ transform_iterator(
</div> </div>
</div> </div>
<div class="section" id="filter-iterator"> <div class="section" id="filter-iterator">
<h3><a class="toc-backref" href="#id52" name="filter-iterator">Filter iterator</a></h3> <h3><a class="toc-backref" href="#id53" 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
@ -1603,7 +1810,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="#id53" 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="#id54" 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
@ -1645,7 +1852,7 @@ class filter_iterator
</div> </div>
</div> </div>
<div class="section" id="filter-iterator-requirements"> <div class="section" id="filter-iterator-requirements">
<h3><a class="toc-backref" href="#id54" name="filter-iterator-requirements"><tt class="literal"><span class="pre">filter_iterator</span></tt> requirements</a></h3> <h3><a class="toc-backref" href="#id55" name="filter-iterator-requirements"><tt class="literal"><span class="pre">filter_iterator</span></tt> requirements</a></h3>
<p>The base <tt class="literal"><span class="pre">Iterator</span></tt> parameter must be a model of Readable <p>The base <tt class="literal"><span class="pre">Iterator</span></tt> parameter must be a model of Readable
Iterator and Single Pass Iterator. The resulting Iterator and Single Pass Iterator. The resulting
<tt class="literal"><span class="pre">filter_iterator</span></tt> will be a model of Forward Traversal Iterator <tt class="literal"><span class="pre">filter_iterator</span></tt> will be a model of Forward Traversal Iterator
@ -1662,7 +1869,7 @@ expression <tt class="literal"><span class="pre">p(x)</span></tt> must be valid
<tt class="literal"><span class="pre">p(x)</span></tt> must be convertible to <tt class="literal"><span class="pre">bool</span></tt>.</p> <tt class="literal"><span class="pre">p(x)</span></tt> must be convertible to <tt class="literal"><span class="pre">bool</span></tt>.</p>
</div> </div>
<div class="section" id="filter-iterator-operations"> <div class="section" id="filter-iterator-operations">
<h3><a class="toc-backref" href="#id55" name="filter-iterator-operations"><tt class="literal"><span class="pre">filter_iterator</span></tt> operations</a></h3> <h3><a class="toc-backref" href="#id56" name="filter-iterator-operations"><tt class="literal"><span class="pre">filter_iterator</span></tt> operations</a></h3>
<p><tt class="literal"><span class="pre">filter_iterator();</span></tt></p> <p><tt class="literal"><span class="pre">filter_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" />
@ -1736,13 +1943,13 @@ filter_iterator(
</table> </table>
</div> </div>
<div class="section" id="counting-iterator"> <div class="section" id="counting-iterator">
<h3><a class="toc-backref" href="#id56" name="counting-iterator">Counting iterator</a></h3> <h3><a class="toc-backref" href="#id57" name="counting-iterator">Counting iterator</a></h3>
<p>The counting iterator adaptor implements dereference by returning a <p>The counting iterator adaptor implements dereference by returning a
reference to the base object. The other operations are implemented by reference to the base object. The other operations are implemented by
the base <tt class="literal"><span class="pre">m_iterator</span></tt>, as per the inheritance from the base <tt class="literal"><span class="pre">m_iterator</span></tt>, as per the inheritance from
<tt class="literal"><span class="pre">iterator_adaptor</span></tt>.</p> <tt class="literal"><span class="pre">iterator_adaptor</span></tt>.</p>
<div class="section" id="class-template-counting-iterator"> <div class="section" id="class-template-counting-iterator">
<h4><a class="toc-backref" href="#id57" 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="#id58" 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
@ -1781,7 +1988,7 @@ the cases when the <tt class="literal"><span class="pre">Incrementable</span></t
</div> </div>
</div> </div>
<div class="section" id="counting-iterator-requirements"> <div class="section" id="counting-iterator-requirements">
<h3><a class="toc-backref" href="#id58" name="counting-iterator-requirements"><tt class="literal"><span class="pre">counting_iterator</span></tt> requirements</a></h3> <h3><a class="toc-backref" href="#id59" name="counting-iterator-requirements"><tt class="literal"><span class="pre">counting_iterator</span></tt> requirements</a></h3>
<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 integegral type.</p> an implementation defined signed integegral type.</p>
@ -1809,7 +2016,7 @@ i &lt; j
</pre> </pre>
</div> </div>
<div class="section" id="counting-iterator-operations"> <div class="section" id="counting-iterator-operations">
<h3><a class="toc-backref" href="#id59" name="counting-iterator-operations"><tt class="literal"><span class="pre">counting_iterator</span></tt> operations</a></h3> <h3><a class="toc-backref" href="#id60" name="counting-iterator-operations"><tt class="literal"><span class="pre">counting_iterator</span></tt> operations</a></h3>
<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" />
@ -1840,7 +2047,7 @@ object copy constructed from <tt class="literal"><span class="pre">x</span></tt>
</table> </table>
</div> </div>
<div class="section" id="function-output-iterator"> <div class="section" id="function-output-iterator">
<h3><a class="toc-backref" href="#id60" name="function-output-iterator">Function output iterator</a></h3> <h3><a class="toc-backref" href="#id61" 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
@ -1849,7 +2056,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="#id61" 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="#id62" 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 {
@ -1877,7 +2084,7 @@ public:
</div> </div>
</div> </div>
<div class="section" id="function-output-iterator-requirements"> <div class="section" id="function-output-iterator-requirements">
<h3><a class="toc-backref" href="#id62" name="function-output-iterator-requirements"><tt class="literal"><span class="pre">function_output_iterator</span></tt> requirements</a></h3> <h3><a class="toc-backref" href="#id63" name="function-output-iterator-requirements"><tt class="literal"><span class="pre">function_output_iterator</span></tt> requirements</a></h3>
<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>.
@ -1885,7 +2092,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">
<h3><a class="toc-backref" href="#id63" name="function-output-iterator-operations"><tt class="literal"><span class="pre">function_output_iterator</span></tt> operations</a></h3> <h3><a class="toc-backref" href="#id64" name="function-output-iterator-operations"><tt class="literal"><span class="pre">function_output_iterator</span></tt> operations</a></h3>
<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" />
@ -1926,7 +2133,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">
<h3><a class="toc-backref" href="#id64" name="function-output-iterator-output-proxy-operations"><tt class="literal"><span class="pre">function_output_iterator::output_proxy</span></tt> operations</a></h3> <h3><a class="toc-backref" href="#id65" name="function-output-iterator-output-proxy-operations"><tt class="literal"><span class="pre">function_output_iterator::output_proxy</span></tt> operations</a></h3>
<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" />
@ -1960,5 +2167,11 @@ LocalWords: OtherIncrementable Coplien -->
</div> </div>
</div> </div>
</div> </div>
<hr class="footer" />
<div class="footer">
<a class="reference" href="facade-and-adaptor.rst">View document source</a>.
Generated on: 2004-01-10 18:59 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

@ -284,11 +284,13 @@ up often. In order to ease the implementation of new iterators,
the Boost.Iterator library provides the <a class="reference" href="iterator_facade.html"><tt class="literal"><span class="pre">iterator_facade</span></tt></a> class template, the Boost.Iterator library provides the <a class="reference" href="iterator_facade.html"><tt class="literal"><span class="pre">iterator_facade</span></tt></a> class template,
which implements many useful defaults and compile-time checks which implements many useful defaults and compile-time checks
designed to help the author iterator ensure that his iterator is designed to help the author iterator ensure that his iterator is
correct. It is common to define a new iterator which behaves like correct.</p>
another iterator, but which modifies some aspect of its behavior. <p>It is also common to define a new iterator that is similar to some
For that purpose, the library supplies the <a class="reference" href="iterator_adaptor.html"><tt class="literal"><span class="pre">iterator_adaptor</span></tt></a> class underlying iterator or iterator-like type, but that modifies some
template, which is specially designed to take advantage of as much aspect of the underlying type's behavior. For that purpose, the
of the underlying iterator's behavior as possible.</p> library supplies the <a class="reference" href="iterator_adaptor.html"><tt class="literal"><span class="pre">iterator_adaptor</span></tt></a> class template, which is specially
designed to take advantage of as much of the underlying type's
behavior as possible.</p>
<p>Both <a class="reference" href="iterator_facade.html"><tt class="literal"><span class="pre">iterator_facade</span></tt></a> and <a class="reference" href="iterator_adaptor.html"><tt class="literal"><span class="pre">iterator_adaptor</span></tt></a> as well as many of the <a class="reference" href="#specialized-adaptors">specialized <p>Both <a class="reference" href="iterator_facade.html"><tt class="literal"><span class="pre">iterator_facade</span></tt></a> and <a class="reference" href="iterator_adaptor.html"><tt class="literal"><span class="pre">iterator_adaptor</span></tt></a> as well as many of the <a class="reference" href="#specialized-adaptors">specialized
adaptors</a> mentioned below have been proposed for standardization, adaptors</a> mentioned below have been proposed for standardization,
and accepted into the first C++ technical report; see our</p> and accepted into the first C++ technical report; see our</p>
@ -409,7 +411,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: 2003-11-24 04:21 UTC. Generated on: 2004-01-10 18:59 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

@ -84,11 +84,14 @@ up often. In order to ease the implementation of new iterators,
the Boost.Iterator library provides the |facade|_ class template, the Boost.Iterator library provides the |facade|_ class template,
which implements many useful defaults and compile-time checks which implements many useful defaults and compile-time checks
designed to help the author iterator ensure that his iterator is designed to help the author iterator ensure that his iterator is
correct. It is common to define a new iterator which behaves like correct.
another iterator, but which modifies some aspect of its behavior.
For that purpose, the library supplies the |adaptor|_ class It is also common to define a new iterator that is similar to some
template, which is specially designed to take advantage of as much underlying iterator or iterator-like type, but that modifies some
of the underlying iterator's behavior as possible. aspect of the underlying type's behavior. For that purpose, the
library supplies the |adaptor|_ class template, which is specially
designed to take advantage of as much of the underlying type's
behavior as possible.
.. |facade| replace:: ``iterator_facade`` .. |facade| replace:: ``iterator_facade``
.. _facade: iterator_facade.html .. _facade: iterator_facade.html

View File

@ -242,70 +242,104 @@ iterators over smart pointers, which the impl handles. -JGS -->
<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-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-operations" id="id2" name="id2"><tt class="literal"><span class="pre">indirect_iterator</span></tt> operations</a></li> <li><a class="reference" href="#indirect-iterator-models" id="id2" name="id2"><tt class="literal"><span class="pre">indirect_iterator</span></tt> models</a></li>
<li><a class="reference" href="#indirect-iterator-operations" id="id3" name="id3"><tt class="literal"><span class="pre">indirect_iterator</span></tt> operations</a></li>
</ul> </ul>
</div> </div>
<pre class="literal-block"> <pre class="literal-block">
template &lt; template &lt;
class Iterator class Iterator
, class Value = use_default , class Value = use_default
, unsigned Access = use_default_access , class CategoryOrTraversal = use_default
, class Traversal = use_default
, class Reference = use_default , class Reference = use_default
, class Difference = use_default , class Difference = use_default
&gt; &gt;
class indirect_iterator class indirect_iterator
: public iterator_adaptor&lt;/* see discussion */&gt;
{ {
friend class iterator_core_access;
public: public:
typedef /* see below */ value_type;
typedef /* see below */ reference;
typedef /* see below */ pointer;
typedef /* see below */ difference_type;
typedef /* see below */ iterator_category;
indirect_iterator(); indirect_iterator();
indirect_iterator(Iterator x); indirect_iterator(Iterator x);
template &lt; template &lt;
class Iterator2, class Value2, unsigned Access2, class Traversal2 class Iterator2, class Value2, class Category2
, class Reference2, class Difference2 , class Reference2, class Difference2
&gt; &gt;
indirect_iterator( indirect_iterator(
indirect_iterator&lt; indirect_iterator&lt;
Iterator2, Value2, Access2, Traversal2, Reference2, Difference2 Iterator2, Value2, Category2, Reference2, Difference2
&gt; const&amp; y &gt; const&amp; y
, typename enable_if_convertible&lt;Iterator2, Iterator&gt;::type* = 0 // exposition , typename enable_if_convertible&lt;Iterator2, Iterator&gt;::type* = 0 // exposition
); );
private: // as-if specification
typename indirect_iterator::reference dereference() const
{
return **this-&gt;base();
}
}; };
</pre> </pre>
<p>The member types of <tt class="literal"><span class="pre">indirect_iterator</span></tt> are defined according to the
following pseudo-code. We use the abbreviation
<tt class="literal"><span class="pre">V=iterator_traits&lt;Iterator&gt;::value_type</span></tt>.:</p>
<pre class="literal-block">
if (Value is use_default) then
typedef iterator_traits&lt;V&gt;::value_type value_type;
else
typedef remove_const&lt;Value&gt;::type value_type;
if (Reference is use_default) then
if (Value is use_default) then
typedef iterator_traits&lt;V&gt;::reference reference;
else
typedef Value&amp; reference;
else
typedef Reference reference;
if (Value is use_default) then
typedef ?? pointer;
else
typedef Value* pointer;
if (Difference is use_default)
typedef iterator_traits&lt;Iterator&gt;::difference_type difference_type;
else
typedef Difference difference_type;
</pre>
<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
iterator as specified in the models section.</p>
<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="#id1" 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">value_type</span></tt> of the <tt class="literal"><span class="pre">Iterator</span></tt> template parameter should <p>The <tt class="literal"><span class="pre">Iterator</span></tt> argument shall meet the requirements of Readable
itself be dereferenceable. The return type of the <tt class="literal"><span class="pre">operator*</span></tt> for Iterator. The <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> argument shall be one of the
the <tt class="literal"><span class="pre">value_type</span></tt> must be the same type as the <tt class="literal"><span class="pre">Reference</span></tt> template standard iterator tags or <tt class="literal"><span class="pre">use_default</span></tt>. If <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt>
parameter. The <tt class="literal"><span class="pre">Value</span></tt> template parameter will be the <tt class="literal"><span class="pre">value_type</span></tt> is an iterator tag, the template parameter <tt class="literal"><span class="pre">Iterator</span></tt> argument shall
for the <tt class="literal"><span class="pre">indirect_iterator</span></tt>, unless <tt class="literal"><span class="pre">Value</span></tt> is const. If <tt class="literal"><span class="pre">Value</span></tt> meet the traversal requirements corresponding to the iterator tag.</p>
is <tt class="literal"><span class="pre">const</span> <span class="pre">X</span></tt>, then <tt class="literal"><span class="pre">value_type</span></tt> will be <em>non-</em> <tt class="literal"><span class="pre">const</span> <span class="pre">X</span></tt>. The <p>The expression <tt class="literal"><span class="pre">*v</span></tt>, where <tt class="literal"><span class="pre">v</span></tt> is an object of type
default for <tt class="literal"><span class="pre">Value</span></tt> is</p> <tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt>, must be a valid expression
<pre class="literal-block"> and must be convertible to <tt class="literal"><span class="pre">indirect_iterator::reference</span></tt>. Also
iterator_traits&lt; iterator_traits&lt;Iterator&gt;::value_type &gt;::value_type <tt class="literal"><span class="pre">indirect_iterator::reference</span></tt> must be convertible to
</pre> <tt class="literal"><span class="pre">indirect_iterator::value</span></tt>. There are further requirements on the
<p>If the default is used for <tt class="literal"><span class="pre">Value</span></tt>, then there must be a valid <tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt> if the <tt class="literal"><span class="pre">Value</span></tt> parameter
specialization of <tt class="literal"><span class="pre">iterator_traits</span></tt> for the value type of the base is not <tt class="literal"><span class="pre">use_default</span></tt>, as implied by the algorithm for deducing the
iterator.</p> default for the <tt class="literal"><span class="pre">value_type</span></tt> member.</p>
<p>The <tt class="literal"><span class="pre">Reference</span></tt> parameter will be the <tt class="literal"><span class="pre">reference</span></tt> type of the </div>
<tt class="literal"><span class="pre">indirect_iterator</span></tt>. The default is <tt class="literal"><span class="pre">Value&amp;</span></tt>.</p> <div class="section" id="indirect-iterator-models">
<p>The <tt class="literal"><span class="pre">Access</span></tt> and <tt class="literal"><span class="pre">Traversal</span></tt> parameters are passed unchanged to <h1><a class="toc-backref" href="#id2" name="indirect-iterator-models"><tt class="literal"><span class="pre">indirect_iterator</span></tt> models</a></h1>
the corresponding parameters of the <tt class="literal"><span class="pre">iterator_adaptor</span></tt> base <p>If <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> is a standard iterator tag,
class, and the <tt class="literal"><span class="pre">Iterator</span></tt> parameter is passed unchanged as the <tt class="literal"><span class="pre">indirect_iterator</span></tt> is a model of the iterator concept corresponding
<tt class="literal"><span class="pre">Base</span></tt> parameter to the <tt class="literal"><span class="pre">iterator_adaptor</span></tt> base class.</p> to the tag, otherwise <tt class="literal"><span class="pre">indirect_iterator</span></tt> satisfies the requirements
<p>The indirect iterator will model the most refined standard traversal of the most refined standard traversal concept that is satisfied by
concept that is modeled by the <tt class="literal"><span class="pre">Iterator</span></tt> type. The indirect the <tt class="literal"><span class="pre">Iterator</span></tt> argument.</p>
iterator will model the most refined standard access concept that is <p><tt class="literal"><span class="pre">indirect_iterator</span></tt> models Readable Iterator. If
modeled by the value type of <tt class="literal"><span class="pre">Iterator</span></tt>.</p> <tt class="literal"><span class="pre">indirect_iterator::reference(*v)</span> <span class="pre">=</span> <span class="pre">t</span></tt> is a valid expression (where
<tt class="literal"><span class="pre">t</span></tt> is an object of type <tt class="literal"><span class="pre">indirect_iterator::value_type</span></tt>) then
<tt class="literal"><span class="pre">indirect_iterator</span></tt> models Writable Iterator. If
<tt class="literal"><span class="pre">indirect_iterator::reference</span></tt> is a reference then
<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="#id2" name="indirect-iterator-operations"><tt class="literal"><span class="pre">indirect_iterator</span></tt> operations</a></h1> <h1><a class="toc-backref" href="#id3" name="indirect-iterator-operations"><tt class="literal"><span class="pre">indirect_iterator</span></tt> operations</a></h1>
<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" />
@ -314,7 +348,7 @@ modeled by the value type of <tt class="literal"><span class="pre">Iterator</spa
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="literal"><span class="pre">Iterator</span></tt> must be Default Constructible.</td> <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="literal"><span class="pre">Iterator</span></tt> must be Default Constructible.</td>
</tr> </tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">indirect_iterator</span></tt> with <tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">indirect_iterator</span></tt> with
a default constructed base object.</td> a default-constructed <tt class="literal"><span class="pre">iterator_adaptor</span></tt> subobject.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -346,7 +380,8 @@ indirect_iterator(
<tbody valign="top"> <tbody valign="top">
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="literal"><span class="pre">Iterator2</span></tt> is implicitly convertible to <tt class="literal"><span class="pre">Iterator</span></tt>.</td> <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="literal"><span class="pre">Iterator2</span></tt> is implicitly convertible to <tt class="literal"><span class="pre">Iterator</span></tt>.</td>
</tr> </tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">indirect_iterator</span></tt> that is a copy of <tt class="literal"><span class="pre">y</span></tt>.</td> <tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">indirect_iterator</span></tt> whose
<tt class="literal"><span class="pre">iterator_adaptor</span></tt> subobject is constructed from <tt class="literal"><span class="pre">y.base()</span></tt>.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -355,7 +390,7 @@ indirect_iterator(
<hr class="footer" /> <hr class="footer" />
<div class="footer"> <div class="footer">
<a class="reference" href="indirect_iterator.rst">View document source</a>. <a class="reference" href="indirect_iterator.rst">View document source</a>.
Generated on: 2003-11-24 05:00 UTC. Generated on: 2004-01-10 18:59 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

@ -7,7 +7,7 @@
<title>Iterator Facade</title> <title>Iterator Facade</title>
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" /> <meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" /> <meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
<meta name="date" content="2003-09-14" /> <meta name="date" content="2003-11-24" />
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" /> <meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
<style type="text/css"><!-- <style type="text/css"><!--
@ -218,7 +218,7 @@ ul.auto-toc {
Lab</a>, University of Hanover <a class="last reference" href="http://www.ive.uni-hannover.de">Institute for Transport Lab</a>, University of Hanover <a class="last reference" href="http://www.ive.uni-hannover.de">Institute for Transport
Railway Operation and Construction</a></td></tr> Railway Operation and Construction</a></td></tr>
<tr><th class="docinfo-name">Date:</th> <tr><th class="docinfo-name">Date:</th>
<td>2003-09-14</td></tr> <td>2003-11-24</td></tr>
<tr><th class="docinfo-name">Copyright:</th> <tr><th class="docinfo-name">Copyright:</th>
<td>Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved</td></tr> <td>Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved</td></tr>
</tbody> </tbody>
@ -227,31 +227,39 @@ Railway Operation and Construction</a></td></tr>
<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">abstract:</th><td class="field-body"></td> <tr class="field"><th class="field-name">abstract:</th><td class="field-body"><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
and associated types, to be supplied by a derived iterator class.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<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
and associated types, to be supplied by a derived iterator class.</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="#motivation" id="id7" name="id7">Motivation</a></li> <li><a class="reference" href="#overview" id="id7" name="id7">Overview</a><ul>
<li><a class="reference" href="#usage" id="id8" name="id8">Usage</a></li> <li><a class="reference" href="#motivation" id="id8" name="id8">Motivation</a></li>
<li><a class="reference" href="#iterator-core-access" id="id9" name="id9">Iterator Core Access</a></li> <li><a class="reference" href="#usage" id="id9" name="id9">Usage</a></li>
<li><a class="reference" href="#operator" id="id10" name="id10"><tt class="literal"><span class="pre">operator[]</span></tt></a></li> <li><a class="reference" href="#iterator-core-access" id="id10" name="id10">Iterator Core Access</a></li>
<li><a class="reference" href="#id2" id="id11" name="id11"><tt class="literal"><span class="pre">operator-&gt;</span></tt></a></li> <li><a class="reference" href="#operator" id="id11" name="id11"><tt class="literal"><span class="pre">operator[]</span></tt></a></li>
<li><a class="reference" href="#reference" id="id12" name="id12">Reference</a><ul> <li><a class="reference" href="#id2" id="id12" name="id12"><tt class="literal"><span class="pre">operator-&gt;</span></tt></a></li>
<li><a class="reference" href="#iterator-facade-usage" id="id13" name="id13"><tt class="literal"><span class="pre">iterator_facade</span></tt> usage</a></li> </ul>
<li><a class="reference" href="#iterator-facade-iterator-category" id="id14" name="id14"><tt class="literal"><span class="pre">iterator_facade</span></tt> iterator category</a></li> </li>
<li><a class="reference" href="#iterator-facade-operations" id="id15" name="id15"><tt class="literal"><span class="pre">iterator_facade</span></tt> operations</a></li> <li><a class="reference" href="#tutorial-example" id="id13" name="id13">Tutorial Example</a></li>
<li><a class="reference" href="#reference" id="id14" name="id14">Reference</a><ul>
<li><a class="reference" href="#ref" id="id15" name="id15">Ref</a><ul>
<li><a class="reference" href="#iterator-facade-usage" id="id16" name="id16"><tt class="literal"><span class="pre">iterator_facade</span></tt> usage</a></li>
<li><a class="reference" href="#iterator-facade-iterator-category" id="id17" name="id17"><tt class="literal"><span class="pre">iterator_facade</span></tt> iterator category</a></li>
<li><a class="reference" href="#iterator-facade-operations" id="id18" name="id18"><tt class="literal"><span class="pre">iterator_facade</span></tt> operations</a></li>
</ul>
</li>
</ul> </ul>
</li> </li>
</ul> </ul>
</div> </div>
<div class="section" id="overview">
<h1><a class="toc-backref" href="#id7" name="overview">Overview</a></h1>
<div class="section" id="motivation"> <div class="section" id="motivation">
<h1><a class="toc-backref" href="#id7" name="motivation">Motivation</a></h1> <h2><a class="toc-backref" href="#id8" name="motivation">Motivation</a></h2>
<!-- Version 1.1 of this ReStructuredText document corresponds to <!-- Version 1.1 of this ReStructuredText document corresponds to
n1530_, the paper accepted by the LWG for TR1. --> n1530_, the paper accepted by the LWG for TR1. -->
<!-- Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All <!-- Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All
@ -295,15 +303,16 @@ impossible.</li>
</blockquote> </blockquote>
</div> </div>
<div class="section" id="usage"> <div class="section" id="usage">
<h1><a class="toc-backref" href="#id8" name="usage">Usage</a></h1> <h2><a class="toc-backref" href="#id9" name="usage">Usage</a></h2>
<p>The user of <tt class="literal"><span class="pre">iterator_facade</span></tt> derives his iterator class from an <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> which takes the derived iterator specialization of <tt class="literal"><span class="pre">iterator_facade</span></tt> and passes the derived
class as the first template parameter. The order of the other iterator class as <tt class="literal"><span class="pre">iterator_facade</span></tt>'s first template parameter.
template parameters to <tt class="literal"><span class="pre">iterator_facade</span></tt> have been carefully chosen The order of the other template parameters have been carefully
to take advantage of useful defaults. For example, when defining a chosen to take advantage of useful defaults. For example, when
constant lvalue iterator, the user can pass a const-qualified version defining a constant lvalue iterator, the user can pass a
of the iterator's <tt class="literal"><span class="pre">value_type</span></tt> as <tt class="literal"><span class="pre">iterator_facade</span></tt>'s <tt class="literal"><span class="pre">Value</span></tt> const-qualified version of the iterator's <tt class="literal"><span class="pre">value_type</span></tt> as
parameter and omit the <tt class="literal"><span class="pre">Reference</span></tt> parameter which follows.</p> <tt class="literal"><span class="pre">iterator_facade</span></tt>'s <tt class="literal"><span class="pre">Value</span></tt> parameter and omit the
<tt class="literal"><span class="pre">Reference</span></tt> parameter which follows.</p>
<p>The derived iterator class must define member functions implementing <p>The derived iterator class must define member functions implementing
the iterator's core behaviors. The following table describes the iterator's core behaviors. The following table describes
expressions which are required to be valid depending on the category expressions which are required to be valid depending on the category
@ -358,7 +367,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">
<h1><a class="toc-backref" href="#id9" name="iterator-core-access">Iterator Core Access</a></h1> <h2><a class="toc-backref" href="#id10" name="iterator-core-access">Iterator Core Access</a></h2>
<p><tt class="literal"><span class="pre">iterator_facade</span></tt> and the operator implementations need to be able <p><tt class="literal"><span class="pre">iterator_facade</span></tt> and the operator implementations need to be able
to access the core member functions in the derived class. Making the to access the core member functions in the derived class. Making the
core member functions public would expose an implementation detail to core member functions public would expose an implementation detail to
@ -392,7 +401,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">
<h1><a class="toc-backref" href="#id10" name="operator"><tt class="literal"><span class="pre">operator[]</span></tt></a></h1> <h2><a class="toc-backref" href="#id11" name="operator"><tt class="literal"><span class="pre">operator[]</span></tt></a></h2>
<p>The indexing operator for a generalized iterator presents special <p>The indexing operator for a generalized iterator presents special
challenges. A random access iterator's <tt class="literal"><span class="pre">operator[]</span></tt> is only challenges. A random access iterator's <tt class="literal"><span class="pre">operator[]</span></tt> is only
required to return something convertible to its <tt class="literal"><span class="pre">value_type</span></tt>. required to return something convertible to its <tt class="literal"><span class="pre">value_type</span></tt>.
@ -413,7 +422,7 @@ iterator class; it will hide the one supplied by <tt class="literal"><span class
from clients of her iterator.</p> from clients of her iterator.</p>
<a class="target" id="operator-arrow" name="operator-arrow"></a></div> <a class="target" id="operator-arrow" name="operator-arrow"></a></div>
<div class="section" id="id2"> <div class="section" id="id2">
<h1><a class="toc-backref" href="#id11" name="id2"><tt class="literal"><span class="pre">operator-&gt;</span></tt></a></h1> <h2><a class="toc-backref" href="#id12" name="id2"><tt class="literal"><span class="pre">operator-&gt;</span></tt></a></h2>
<p>The <tt class="literal"><span class="pre">reference</span></tt> type of a readable iterator (and today's input <p>The <tt class="literal"><span class="pre">reference</span></tt> type of a readable iterator (and today's input
iterator) need not in fact be a reference, so long as it is iterator) need not in fact be a reference, so long as it is
convertible to the iterator's <tt class="literal"><span class="pre">value_type</span></tt>. When the <tt class="literal"><span class="pre">value_type</span></tt> convertible to the iterator's <tt class="literal"><span class="pre">value_type</span></tt>. When the <tt class="literal"><span class="pre">value_type</span></tt>
@ -433,8 +442,16 @@ Patterns, C++ Report, February 1995, pp. 24-27.</td></tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div>
<div class="section" id="tutorial-example">
<h1><a class="toc-backref" href="#id13" name="tutorial-example">Tutorial Example</a></h1>
<p>I'm working on a Tutorial example to go here.</p>
</div>
<div class="section" id="reference"> <div class="section" id="reference">
<h1><a class="toc-backref" href="#id12" name="reference">Reference</a></h1> <h1><a class="toc-backref" href="#id14" name="reference">Reference</a></h1>
<div class="section" id="ref">
<h2><a class="toc-backref" href="#id15" name="ref">Ref</a></h2>
<p>We need to resolve the title levels here.</p>
<!-- Version 1.3 of this ReStructuredText document corresponds to <!-- Version 1.3 of this ReStructuredText document corresponds to
n1530_, the paper accepted by the LWG for TR1. --> n1530_, the paper accepted by the LWG for TR1. -->
<!-- Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All <!-- Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All
@ -546,7 +563,7 @@ struct enable_if_interoperable
{}; {};
</pre> </pre>
<div class="section" id="iterator-facade-usage"> <div class="section" id="iterator-facade-usage">
<h2><a class="toc-backref" href="#id13" name="iterator-facade-usage"><tt class="literal"><span class="pre">iterator_facade</span></tt> usage</a></h2> <h3><a class="toc-backref" href="#id16" 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
@ -630,7 +647,7 @@ Iterator</td>
</table> </table>
<a class="target" id="facade-iterator-category" name="facade-iterator-category"></a></div> <a class="target" id="facade-iterator-category" name="facade-iterator-category"></a></div>
<div class="section" id="iterator-facade-iterator-category"> <div class="section" id="iterator-facade-iterator-category">
<h2><a class="toc-backref" href="#id14" name="iterator-facade-iterator-category"><tt class="literal"><span class="pre">iterator_facade</span></tt> iterator category</a></h2> <h3><a class="toc-backref" href="#id17" 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>
@ -683,7 +700,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">
<h2><a class="toc-backref" href="#id15" name="iterator-facade-operations"><tt class="literal"><span class="pre">iterator_facade</span></tt> operations</a></h2> <h3><a class="toc-backref" href="#id18" 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
@ -822,10 +839,11 @@ return tmp -= n;
</div> </div>
</div> </div>
</div> </div>
</div>
<hr class="footer" /> <hr class="footer" />
<div class="footer"> <div class="footer">
<a class="reference" href="iterator_facade.rst">View document source</a>. <a class="reference" href="iterator_facade.rst">View document source</a>.
Generated on: 2003-11-24 05:00 UTC. Generated on: 2004-01-10 18:59 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

@ -16,19 +16,30 @@
:abstract: :abstract:
.. include:: iterator_facade_abstract.rst .. include:: iterator_facade_abstract.rst
.. contents:: Table of Contents .. contents:: Table of Contents
Overview
========
Motivation Motivation
---------- ----------
.. include:: iterator_facade_body.rst .. include:: iterator_facade_body.rst
Tutorial Example
================
I'm working on a Tutorial example to go here.
Reference Reference
--------- =========
Ref
---
We need to resolve the title levels here.
.. include:: iterator_facade_ref.rst .. include:: iterator_facade_ref.rst

View File

@ -46,14 +46,15 @@ objects for several reasons:
Usage Usage
----- -----
The user of ``iterator_facade`` derives his iterator class from an The user of ``iterator_facade`` derives his iterator class from a
specialization of ``iterator_facade`` which takes the derived iterator specialization of ``iterator_facade`` and passes the derived
class as the first template parameter. The order of the other iterator class as ``iterator_facade``\ 's first template parameter.
template parameters to ``iterator_facade`` have been carefully chosen The order of the other template parameters have been carefully
to take advantage of useful defaults. For example, when defining a chosen to take advantage of useful defaults. For example, when
constant lvalue iterator, the user can pass a const-qualified version defining a constant lvalue iterator, the user can pass a
of the iterator's ``value_type`` as ``iterator_facade``\ 's ``Value`` const-qualified version of the iterator's ``value_type`` as
parameter and omit the ``Reference`` parameter which follows. ``iterator_facade``\ 's ``Value`` parameter and omit the
``Reference`` parameter which follows.
The derived iterator class must define member functions implementing The derived iterator class must define member functions implementing
the iterator's core behaviors. The following table describes the iterator's core behaviors. The following table describes