forked from boostorg/iterator
some major changes to the requirements/models section of counting_iterator
[SVN r21651]
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
<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.2.8: http://docutils.sourceforge.net/" />
|
||||
<title>Counting Iterator</title>
|
||||
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
|
||||
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
|
||||
@ -92,9 +92,13 @@ class counting_iterator
|
||||
<p>If the <tt class="literal"><span class="pre">Diference</span></tt> argument is <tt class="literal"><span class="pre">use_default</span></tt> then the
|
||||
<tt class="literal"><span class="pre">difference_type</span></tt> member is an implementation defined signed
|
||||
integral type.</p>
|
||||
<p>The member <tt class="literal"><span class="pre">iterator_category</span></tt> is a type that satisfies the
|
||||
requirements of the concepts modeled by the <tt class="literal"><span class="pre">counting_iterator</span></tt> as
|
||||
specified in the models section.</p>
|
||||
<p>If <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> is not <tt class="literal"><span class="pre">use_default</span></tt> then the member
|
||||
<tt class="literal"><span class="pre">iterator_category</span></tt> is <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt>. Otherwise, if
|
||||
<tt class="literal"><span class="pre">Incrementable</span></tt> is a numeric type then <tt class="literal"><span class="pre">iterator_category</span></tt> is a
|
||||
type convertible to <tt class="literal"><span class="pre">random_access_traversal_tag</span></tt> and
|
||||
<tt class="literal"><span class="pre">random_access_iterator_tag</span></tt>. If <tt class="literal"><span class="pre">Incrementable</span></tt> is not a numeric
|
||||
type then <tt class="literal"><span class="pre">iterator_category</span></tt> is
|
||||
<tt class="literal"><span class="pre">iterator_traversal<Incrementable>::type</span></tt>.</p>
|
||||
<dl>
|
||||
<dt>[<em>Note:</em> implementers are encouraged to provide an implementation of</dt>
|
||||
<dd><tt class="literal"><span class="pre">distance_to</span></tt> and a <tt class="literal"><span class="pre">difference_type</span></tt> that avoids overflows in
|
||||
@ -105,27 +109,22 @@ the cases when the <tt class="literal"><span class="pre">Incrementable</span></t
|
||||
<h1><a class="toc-backref" href="#id3" name="counting-iterator-requirements"><tt class="literal"><span class="pre">counting_iterator</span></tt> requirements</a></h1>
|
||||
<p>The <tt class="literal"><span class="pre">Incrementable</span></tt> type must be Default Constructible, Copy
|
||||
Constructible, and Assignable.</p>
|
||||
</div>
|
||||
<div class="section" id="counting-iterator-models">
|
||||
<h1><a class="toc-backref" href="#id4" name="counting-iterator-models"><tt class="literal"><span class="pre">counting_iterator</span></tt> models</a></h1>
|
||||
<p><tt class="literal"><span class="pre">counting_iterator</span></tt> models Readable Lvalue Iterator.</p>
|
||||
<p>Furthermore, if you wish to create a counting iterator that is a
|
||||
Forward Traversal Iterator and also Forward Iterator, then the
|
||||
following expressions must be valid:</p>
|
||||
<p>If <tt class="literal"><span class="pre">iterator_category</span></tt> is convertible to <tt class="literal"><span class="pre">forward_iterator_tag</span></tt> or
|
||||
<tt class="literal"><span class="pre">forward_traversal_tag</span></tt> then the following expressions must be valid:</p>
|
||||
<pre class="literal-block">
|
||||
Incrementable i, j;
|
||||
++i // pre-increment
|
||||
i == j // operator equal
|
||||
</pre>
|
||||
<p>If you wish to create a counting iterator that is a Bidirectional
|
||||
Traversal Iterator and also Bidirectional Iterator, then pre-decrement
|
||||
is also required:</p>
|
||||
<p>If <tt class="literal"><span class="pre">iterator_category</span></tt> is convertible to
|
||||
<tt class="literal"><span class="pre">bidirectional_iterator_tag</span></tt> or <tt class="literal"><span class="pre">bidirectional_traversal_tag</span></tt> then
|
||||
pre-decrement is required:</p>
|
||||
<pre class="literal-block">
|
||||
--i
|
||||
</pre>
|
||||
<p>If you wish to create a counting iterator that is a Random Access
|
||||
Traversal Iterator and also Random Access Iterator, then these
|
||||
additional expressions are also required:</p>
|
||||
<p>If <tt class="literal"><span class="pre">iterator_category</span></tt> is convertible to
|
||||
<tt class="literal"><span class="pre">random_access_iterator_tag</span></tt> or <tt class="literal"><span class="pre">random_access_traversal_tag</span></tt> then
|
||||
these additional expressions are also required:</p>
|
||||
<pre class="literal-block">
|
||||
counting_iterator::difference_type n;
|
||||
i += n
|
||||
@ -133,6 +132,13 @@ n = i - j
|
||||
i < j
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section" id="counting-iterator-models">
|
||||
<h1><a class="toc-backref" href="#id4" name="counting-iterator-models"><tt class="literal"><span class="pre">counting_iterator</span></tt> models</a></h1>
|
||||
<p><tt class="literal"><span class="pre">counting_iterator</span></tt> models Readable Lvalue Iterator. In addition,
|
||||
<tt class="literal"><span class="pre">counting_iterator</span></tt> models the concepts corresponding to the
|
||||
iterator tags that <tt class="literal"><span class="pre">counting_iterator::iterator_category</span></tt> is
|
||||
convertible to.</p>
|
||||
</div>
|
||||
<div class="section" id="counting-iterator-operations">
|
||||
<h1><a class="toc-backref" href="#id5" name="counting-iterator-operations"><tt class="literal"><span class="pre">counting_iterator</span></tt> operations</a></h1>
|
||||
<p>In addition to the operations required by the concepts modeled by
|
||||
@ -254,10 +260,10 @@ indirectly printing out the numbers from 0 to 7
|
||||
<p>The source code for this example can be found <a class="reference" href="../example/counting_iterator_example.cpp">here</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="footer" />
|
||||
<hr class="footer"/>
|
||||
<div class="footer">
|
||||
<a class="reference" href="counting_iterator.rst">View document source</a>.
|
||||
Generated on: 2004-01-12 20:46 UTC.
|
||||
Generated on: 2004-01-12 21:18 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>
|
||||
|
Reference in New Issue
Block a user