resolved some issues with counting_iterator

[SVN r21639]
This commit is contained in:
Jeremy Siek
2004-01-12 19:01:57 +00:00
parent b2407b0191
commit 6085e03da0
6 changed files with 88 additions and 39 deletions

View File

@ -63,6 +63,12 @@ template <
class counting_iterator
{
public:
typedef Incrementable value_type;
typedef const Incrementable& reference;
typedef const Incrementable* pointer;
typedef /* see below */ difference_type;
typedef /* see below */ iterator_category;
counting_iterator();
counting_iterator(counting_iterator const& rhs);
explicit counting_iterator(Incrementable x);
@ -74,6 +80,12 @@ class counting_iterator
Incrementable m_inc; // exposition
};
</pre>
<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>
<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
@ -83,27 +95,28 @@ the cases when the <tt class="literal"><span class="pre">Incrementable</span></t
<div class="section" id="counting-iterator-requirements">
<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. The default distance is
an implementation defined signed integral type.</p>
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, then the following expressions must be valid:</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>
<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, then pre-decrement is also required:</p>
<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>
<pre class="literal-block">
--i
</pre>
<p>If you wish to create a counting iterator that is a Random Access
Traversal Iterator, then these additional expressions are also
required:</p>
Traversal Iterator and also Random Access Iterator, then these
additional expressions are also required:</p>
<pre class="literal-block">
counting_iterator::difference_type n;
i += n
@ -235,7 +248,7 @@ indirectly printing out the numbers from 0 to 7
<hr class="footer"/>
<div class="footer">
<a class="reference" href="counting_iterator.rst">View document source</a>.
Generated on: 2004-01-12 16:05 UTC.
Generated on: 2004-01-12 19:01 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>