forked from boostorg/iterator
added make_xxx functions for some of the iterators
[SVN r21611]
This commit is contained in:
@ -3,203 +3,12 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils 0.3.0: http://docutils.sourceforge.net/" />
|
||||
<title>Iterator Facade and Adaptor</title>
|
||||
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
|
||||
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
|
||||
<meta name="date" content="2003-11-24" />
|
||||
<style type="text/css"><!--
|
||||
|
||||
/*
|
||||
:Author: David Goodger
|
||||
:Contact: goodger@users.sourceforge.net
|
||||
:date: $Date$
|
||||
:version: $Revision$
|
||||
:copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
*/
|
||||
|
||||
.first {
|
||||
margin-top: 0 }
|
||||
|
||||
.last {
|
||||
margin-bottom: 0 }
|
||||
|
||||
a.toc-backref {
|
||||
text-decoration: none ;
|
||||
color: black }
|
||||
|
||||
dd {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.abstract {
|
||||
margin: 2em 5em }
|
||||
|
||||
div.abstract p.topic-title {
|
||||
font-weight: bold ;
|
||||
text-align: center }
|
||||
|
||||
div.attention, div.caution, div.danger, div.error, div.hint,
|
||||
div.important, div.note, div.tip, div.warning {
|
||||
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>
|
||||
<link rel="stylesheet" href="default.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="iterator-facade-and-adaptor">
|
||||
@ -308,20 +117,21 @@ by adapting other iterators.</td>
|
||||
</ul>
|
||||
</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="id56" name="id56"><tt class="literal"><span class="pre">filter_iterator</span></tt> operations</a></li>
|
||||
<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="id58" name="id58">Class template <tt class="literal"><span class="pre">counting_iterator</span></tt></a></li>
|
||||
<li><a class="reference" href="#filter-iterator-models" id="id56" name="id56"><tt class="literal"><span class="pre">filter_iterator</span></tt> models</a></li>
|
||||
<li><a class="reference" href="#filter-iterator-operations" id="id57" name="id57"><tt class="literal"><span class="pre">filter_iterator</span></tt> operations</a></li>
|
||||
<li><a class="reference" href="#counting-iterator" id="id58" name="id58">Counting iterator</a><ul>
|
||||
<li><a class="reference" href="#class-template-counting-iterator" id="id59" name="id59">Class template <tt class="literal"><span class="pre">counting_iterator</span></tt></a></li>
|
||||
</ul>
|
||||
</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="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="id61" name="id61">Function output iterator</a><ul>
|
||||
<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>
|
||||
<li><a class="reference" href="#counting-iterator-requirements" id="id60" name="id60"><tt class="literal"><span class="pre">counting_iterator</span></tt> requirements</a></li>
|
||||
<li><a class="reference" href="#counting-iterator-operations" id="id61" name="id61"><tt class="literal"><span class="pre">counting_iterator</span></tt> operations</a></li>
|
||||
<li><a class="reference" href="#function-output-iterator" id="id62" name="id62">Function output iterator</a><ul>
|
||||
<li><a class="reference" href="#class-template-function-output-iterator" id="id63" name="id63">Class template <tt class="literal"><span class="pre">function_output_iterator</span></tt></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#function-output-iterator-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="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="id65" name="id65"><tt class="literal"><span class="pre">function_output_iterator::output_proxy</span></tt> operations</a></li>
|
||||
<li><a class="reference" href="#function-output-iterator-requirements" id="id64" name="id64"><tt class="literal"><span class="pre">function_output_iterator</span></tt> requirements</a></li>
|
||||
<li><a class="reference" href="#function-output-iterator-operations" id="id65" name="id65"><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="id66" name="id66"><tt class="literal"><span class="pre">function_output_iterator::output_proxy</span></tt> operations</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -604,14 +414,16 @@ into the temporary iterator <tt class="literal"><span class="pre">p+n</span></tt
|
||||
<tt class="literal"><span class="pre">operator[]</span></tt> returns.</p>
|
||||
<p>Writable iterators built with <tt class="literal"><span class="pre">iterator_facade</span></tt> implement the
|
||||
semantics required by the preferred resolution to <a class="reference" href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#299">issue 299</a> and
|
||||
adopted by proposal <a class="reference" href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/papers/2003/n1550.html">n1550</a>: the result of <tt class="literal"><span class="pre">p[n]</span></tt> is a proxy object
|
||||
containing a copy of <tt class="literal"><span class="pre">p+n</span></tt>, and <tt class="literal"><span class="pre">p[n]</span> <span class="pre">=</span> <span class="pre">x</span></tt> is equivalent to <tt class="literal"><span class="pre">*(p</span>
|
||||
<span class="pre">+</span> <span class="pre">n)</span> <span class="pre">=</span> <span class="pre">x</span></tt>. This approach will work properly for any random-access
|
||||
iterator regardless of the other details of its implementation. A
|
||||
user who knows more about the implementation of her iterator is free
|
||||
to implement an <tt class="literal"><span class="pre">operator[]</span></tt> which returns an lvalue in the derived
|
||||
iterator class; it will hide the one supplied by <tt class="literal"><span class="pre">iterator_facade</span></tt>
|
||||
from clients of her iterator.</p>
|
||||
adopted by proposal <a class="reference" href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/papers/2003/n1550.html">n1550</a>: the result of <tt class="literal"><span class="pre">p[n]</span></tt> is an object
|
||||
convertible to the iterator's <tt class="literal"><span class="pre">value_type</span></tt>, and <tt class="literal"><span class="pre">p[n]</span> <span class="pre">=</span> <span class="pre">x</span></tt> is
|
||||
equivalent to <tt class="literal"><span class="pre">*(p</span> <span class="pre">+</span> <span class="pre">n)</span> <span class="pre">=</span> <span class="pre">x</span></tt> (Note: This result object may be
|
||||
implemented as a proxy containing a copy of <tt class="literal"><span class="pre">p+n</span></tt>). This approach
|
||||
will work properly for any random-access iterator regardless of the
|
||||
other details of its implementation. A user who knows more about
|
||||
the implementation of her iterator is free to implement an
|
||||
<tt class="literal"><span class="pre">operator[]</span></tt> that returns an lvalue in the derived iterator
|
||||
class; it will hide the one supplied by <tt class="literal"><span class="pre">iterator_facade</span></tt> from
|
||||
clients of her iterator.</p>
|
||||
<a class="target" id="operator-arrow" name="operator-arrow"></a></div>
|
||||
<div class="section" id="id6">
|
||||
<h3><a class="toc-backref" href="#id22" name="id6"><tt class="literal"><span class="pre">operator-></span></tt></a></h3>
|
||||
@ -1066,10 +878,13 @@ of type <tt class="literal"><span class="pre">pointer</span></tt> equal to:</p>
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">an object convertible to <tt class="literal"><span class="pre">reference</span></tt> and holding a copy
|
||||
<em>p</em> of <tt class="literal"><span class="pre">*static_cast<Derived</span> <span class="pre">const*>(this)</span> <span class="pre">+</span> <span class="pre">n</span></tt> such that, for a constant object <tt class="literal"><span class="pre">v</span></tt> of type
|
||||
<tt class="literal"><span class="pre">value_type</span></tt>, <tt class="literal"><span class="pre">(*static_cast<Derived</span> <span class="pre">const*>(this))[n]</span> <span class="pre">=</span> <span class="pre">v</span></tt> is equivalent
|
||||
to <tt class="literal"><span class="pre">p</span> <span class="pre">=</span> <span class="pre">v</span></tt>.</td>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">an object convertible to <tt class="literal"><span class="pre">value_type</span></tt>. For constant
|
||||
objects <tt class="literal"><span class="pre">v</span></tt> of type <tt class="literal"><span class="pre">value_type</span></tt>, and <tt class="literal"><span class="pre">n</span></tt> of type
|
||||
<tt class="literal"><span class="pre">difference_type</span></tt>, and reference <tt class="literal"><span class="pre">p</span></tt> equal to
|
||||
<tt class="literal"><span class="pre">*static_cast<Derived</span> <span class="pre">const*>(this)</span></tt>, <tt class="literal"><span class="pre">(*this)[n]</span> <span class="pre">=</span> <span class="pre">v</span></tt> is
|
||||
equivalent to <tt class="literal"><span class="pre">*(p+</span> <span class="pre">n)</span> <span class="pre">=</span> <span class="pre">v</span></tt>, and <tt class="literal"><span class="pre">static_cast<value_type</span>
|
||||
<span class="pre">const&>((*this)[n])</span></tt> is equivalent to
|
||||
<tt class="literal"><span class="pre">static_cast<value_type</span> <span class="pre">const&>(*(p+n))</span></tt></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -1814,13 +1629,14 @@ iterator and the end of the range.</p>
|
||||
<pre class="literal-block">
|
||||
template <class Predicate, class Iterator>
|
||||
class filter_iterator
|
||||
: public iterator_adaptor<
|
||||
filter_iterator<Predicate, Iterator>, Iterator
|
||||
, use_default
|
||||
, /* see details */
|
||||
>
|
||||
{
|
||||
public:
|
||||
typedef iterator_traits<Iterator>::value_type value_type;
|
||||
typedef iterator_traits<Iterator>::reference reference;
|
||||
typedef iterator_traits<Iterator>::pointer pointer;
|
||||
typedef iterator_traits<Iterator>::difference_type difference_type;
|
||||
typedef /* see below */ iterator_category;
|
||||
|
||||
filter_iterator();
|
||||
filter_iterator(Predicate f, Iterator x, Iterator end = Iterator());
|
||||
filter_iterator(Iterator x, Iterator end = Iterator());
|
||||
@ -1831,45 +1647,122 @@ class filter_iterator
|
||||
);
|
||||
Predicate predicate() const;
|
||||
Iterator end() const;
|
||||
|
||||
private: // as-if specification
|
||||
void increment()
|
||||
{
|
||||
++(this->base_reference());
|
||||
satisfy_predicate();
|
||||
}
|
||||
|
||||
void satisfy_predicate()
|
||||
{
|
||||
while (this->base() != this->m_end && !this->m_predicate(*this->base()))
|
||||
++(this->base_reference());
|
||||
}
|
||||
|
||||
Predicate m_predicate;
|
||||
Iterator m_end;
|
||||
};
|
||||
</pre>
|
||||
<p>The <tt class="literal"><span class="pre">iterator_category</span></tt> is a type convertible to the tags
|
||||
corresponding to each standard concept modeled by <tt class="literal"><span class="pre">filter_iterator</span></tt>,
|
||||
as described in the models section.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="filter-iterator-requirements">
|
||||
<h3><a class="toc-backref" href="#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
|
||||
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
|
||||
if <tt class="literal"><span class="pre">Iterator</span></tt> is, otherwise the <tt class="literal"><span class="pre">filter_iterator</span></tt> will be a
|
||||
model of Single Pass Iterator. The access category of the
|
||||
<tt class="literal"><span class="pre">filter_iterator</span></tt> will be the same as the access category of
|
||||
<tt class="literal"><span class="pre">Iterator</span></tt>.</p>
|
||||
<!-- Thomas is going to try implementing filter_iterator so that
|
||||
it will be bidirectional if the underlying iterator is. -JGS -->
|
||||
<p>The <tt class="literal"><span class="pre">Predicate</span></tt> 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
|
||||
<p>The <tt class="literal"><span class="pre">Predicate</span></tt> argument must be Assignable, Copy Constructible, and
|
||||
the expression <tt class="literal"><span class="pre">p(x)</span></tt> must be valid where <tt class="literal"><span class="pre">p</span></tt> is an object of type
|
||||
<tt class="literal"><span class="pre">Predicate</span></tt>, <tt class="literal"><span class="pre">x</span></tt> is an object of type
|
||||
<tt class="literal"><span class="pre">iterator_traits<Iterator>::value_type</span></tt>, and where the type of
|
||||
<tt class="literal"><span class="pre">p(x)</span></tt> must be convertible to <tt class="literal"><span class="pre">bool</span></tt>.</p>
|
||||
<p>The <tt class="literal"><span class="pre">Iterator</span></tt> argument shall meet the requirements of Readable
|
||||
Iterator and Single Pass Iterator or it shall meet the requirements of
|
||||
Input Iterator.</p>
|
||||
</div>
|
||||
<div class="section" id="filter-iterator-models">
|
||||
<h3><a class="toc-backref" href="#id56" name="filter-iterator-models"><tt class="literal"><span class="pre">filter_iterator</span></tt> models</a></h3>
|
||||
<p>The concepts that <tt class="literal"><span class="pre">filter_iterator</span></tt> models are dependent on what
|
||||
concepts the <tt class="literal"><span class="pre">Iterator</span></tt> argument models, as specified in the
|
||||
following tables.</p>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
<col width="33%" />
|
||||
<col width="67%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th>If <tt class="literal"><span class="pre">Iterator</span></tt> models</th>
|
||||
<th>then <tt class="literal"><span class="pre">filter_iterator</span></tt> models</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr><td>Single Pass Iterator</td>
|
||||
<td>Single Pass Iterator</td>
|
||||
</tr>
|
||||
<tr><td>Forward Traversal Iterator</td>
|
||||
<td>Forward Traversal Iterator</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
<col width="41%" />
|
||||
<col width="59%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th>If <tt class="literal"><span class="pre">Iterator</span></tt> models</th>
|
||||
<th>then <tt class="literal"><span class="pre">filter_iterator</span></tt> models</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr><td>Readable Iterator</td>
|
||||
<td>Readable Iterator</td>
|
||||
</tr>
|
||||
<tr><td>Writable Iterator</td>
|
||||
<td>Writable Iterator</td>
|
||||
</tr>
|
||||
<tr><td>Lvalue Iterator</td>
|
||||
<td>Lvalue Iterator</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
<col width="63%" />
|
||||
<col width="38%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th>If <tt class="literal"><span class="pre">Iterator</span></tt> models</th>
|
||||
<th>then <tt class="literal"><span class="pre">filter_iterator</span></tt> models</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr><td>Readable Iterator, Single Pass Iterator</td>
|
||||
<td>Input Iterator</td>
|
||||
</tr>
|
||||
<tr><td>Readable Lvalue Iterator, Forward Traversal Iterator</td>
|
||||
<td>Forward Iterator</td>
|
||||
</tr>
|
||||
<tr><td>Writable Lvalue Iterator, Forward Traversal Iterator</td>
|
||||
<td>Mutable Forward Iterator</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
<col width="33%" />
|
||||
<col width="67%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th>If <tt class="literal"><span class="pre">Iterator</span></tt> models</th>
|
||||
<th>then <tt class="literal"><span class="pre">filter_iterator</span></tt> models</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr><td>Input Iterator</td>
|
||||
<td>Input Iterator, Readable Iterator, Single Pass Iterator</td>
|
||||
</tr>
|
||||
<tr><td>Forward Iterator</td>
|
||||
<td>Forward Iterator, Readable Lvalue Iterator,
|
||||
Forward Traversal Iterator</td>
|
||||
</tr>
|
||||
<tr><td>Mutable Forward Iterator</td>
|
||||
<td>Mutable Forward Iterator, Writable Lvalue Iterator,
|
||||
Forward Traversal Iterator</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section" id="filter-iterator-operations">
|
||||
<h3><a class="toc-backref" href="#id56" name="filter-iterator-operations"><tt class="literal"><span class="pre">filter_iterator</span></tt> operations</a></h3>
|
||||
<h3><a class="toc-backref" href="#id57" name="filter-iterator-operations"><tt class="literal"><span class="pre">filter_iterator</span></tt> operations</a></h3>
|
||||
<p>In addition to those operations required by the concepts that
|
||||
<tt class="literal"><span class="pre">filter_iterator</span></tt> models, <tt class="literal"><span class="pre">filter_iterator</span></tt> provides the following
|
||||
operations.</p>
|
||||
<p><tt class="literal"><span class="pre">filter_iterator();</span></tt></p>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@ -1937,19 +1830,19 @@ filter_iterator(
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">The object <tt class="literal"><span class="pre">end</span></tt> used to construct <tt class="literal"><span class="pre">*this</span></tt>.</td>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">A copy of the object <tt class="literal"><span class="pre">end</span></tt> used to construct <tt class="literal"><span class="pre">*this</span></tt>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section" id="counting-iterator">
|
||||
<h3><a class="toc-backref" href="#id57" name="counting-iterator">Counting iterator</a></h3>
|
||||
<h3><a class="toc-backref" href="#id58" name="counting-iterator">Counting iterator</a></h3>
|
||||
<p>The counting iterator adaptor implements dereference by returning a
|
||||
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
|
||||
<tt class="literal"><span class="pre">iterator_adaptor</span></tt>.</p>
|
||||
<div class="section" id="class-template-counting-iterator">
|
||||
<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>
|
||||
<h4><a class="toc-backref" href="#id59" name="class-template-counting-iterator">Class template <tt class="literal"><span class="pre">counting_iterator</span></tt></a></h4>
|
||||
<pre class="literal-block">
|
||||
template <
|
||||
class Incrementable
|
||||
@ -1988,7 +1881,7 @@ the cases when the <tt class="literal"><span class="pre">Incrementable</span></t
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="counting-iterator-requirements">
|
||||
<h3><a class="toc-backref" href="#id59" name="counting-iterator-requirements"><tt class="literal"><span class="pre">counting_iterator</span></tt> requirements</a></h3>
|
||||
<h3><a class="toc-backref" href="#id60" 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
|
||||
Constructible, and Assignable. The default distance is
|
||||
an implementation defined signed integegral type.</p>
|
||||
@ -2016,7 +1909,7 @@ i < j
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section" id="counting-iterator-operations">
|
||||
<h3><a class="toc-backref" href="#id60" name="counting-iterator-operations"><tt class="literal"><span class="pre">counting_iterator</span></tt> operations</a></h3>
|
||||
<h3><a class="toc-backref" href="#id61" 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>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@ -2047,7 +1940,7 @@ object copy constructed from <tt class="literal"><span class="pre">x</span></tt>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section" id="function-output-iterator">
|
||||
<h3><a class="toc-backref" href="#id61" name="function-output-iterator">Function output iterator</a></h3>
|
||||
<h3><a class="toc-backref" href="#id62" name="function-output-iterator">Function output iterator</a></h3>
|
||||
<p>The function output iterator adaptor makes it easier to create custom
|
||||
output iterators. The adaptor takes a unary function and creates a
|
||||
model of Output Iterator. Each item assigned to the output iterator is
|
||||
@ -2056,7 +1949,7 @@ iterator is that creating a conforming output iterator is non-trivial,
|
||||
particularly because the proper implementation usually requires a
|
||||
proxy object.</p>
|
||||
<div class="section" id="class-template-function-output-iterator">
|
||||
<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>
|
||||
<h4><a class="toc-backref" href="#id63" 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">
|
||||
template <class UnaryFunction>
|
||||
class function_output_iterator {
|
||||
@ -2084,7 +1977,7 @@ public:
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="function-output-iterator-requirements">
|
||||
<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>
|
||||
<h3><a class="toc-backref" href="#id64" 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
|
||||
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>.
|
||||
@ -2092,7 +1985,7 @@ The resulting <tt class="literal"><span class="pre">function_output_iterator</sp
|
||||
and Incrementable Iterator concepts.</p>
|
||||
</div>
|
||||
<div class="section" id="function-output-iterator-operations">
|
||||
<h3><a class="toc-backref" href="#id64" 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="#id65" 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&</span> <span class="pre">f</span> <span class="pre">=</span> <span class="pre">UnaryFunction());</span></tt></p>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@ -2133,7 +2026,7 @@ a copy of the unary function <tt class="literal"><span class="pre">f</span></tt>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section" id="function-output-iterator-output-proxy-operations">
|
||||
<h3><a class="toc-backref" href="#id65" 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="#id66" 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&</span> <span class="pre">f);</span></tt></p>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@ -2167,11 +2060,5 @@ LocalWords: OtherIncrementable Coplien -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="footer" />
|
||||
<div class="footer">
|
||||
<a class="reference" href="facade-and-adaptor.rst">View document source</a>.
|
||||
Generated on: 2004-01-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>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user