more work on the specification of iterator_category

[SVN r21662]
This commit is contained in:
Jeremy Siek 2004-01-13 05:56:29 +00:00
parent 2edb688882
commit ec8d069057
9 changed files with 157 additions and 49 deletions

View File

@ -95,9 +95,8 @@ integral type. Otherwise <tt class="literal"><span class="pre">difference_type</
<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
type convertible to <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&lt;Incrementable&gt;::type</span></tt>.</p>
<dl>
<dt>[<em>Note:</em> implementers are encouraged to provide an implementation of</dt>
@ -262,7 +261,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-13 02:54 UTC.
Generated on: 2004-01-13 05:45 UTC.
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
</body>

View File

@ -33,9 +33,8 @@ integral type. Otherwise ``difference_type`` is ``Difference``.
If ``CategoryOrTraversal`` is not ``use_default`` then the member
``iterator_category`` is ``CategoryOrTraversal``. Otherwise, if
``Incrementable`` is a numeric type then ``iterator_category`` is a
type convertible to ``random_access_traversal_tag`` and
``random_access_iterator_tag``. If ``Incrementable`` is not a numeric
type then ``iterator_category`` is
type convertible to ``random_access_iterator_tag``. If
``Incrementable`` is not a numeric type then ``iterator_category`` is
``iterator_traversal<Incrementable>::type``.

View File

@ -1318,7 +1318,7 @@ else
typedef Reference reference;
if (Value is use_default) then
typedef ?? pointer;
typedef iterator_traits&lt;V&gt;::value_type* pointer;
else
typedef Value* pointer;
@ -1327,9 +1327,21 @@ if (Difference is use_default)
else
typedef Difference difference_type;
</pre>
<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">indirect_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
<tt class="literal"><span class="pre">iterator_category</span></tt> is <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt>. Otherwise
<tt class="literal"><span class="pre">iterator_category</span></tt> is a type convertible to the tag determined by
the following algorithm. Let <tt class="literal"><span class="pre">C</span></tt> be <tt class="literal"><span class="pre">traveral_category&lt;Iterator&gt;::type</span></tt>.</p>
<pre class="literal-block">
if (reference is a reference to value_type) then
if (C is convertible to random_access_traversal_tag) then
random_access_iterator_tag
else if (C is convertible to bidirectional_traversal_tag) then
bidirectional_iterator_tag
else
forward_iterator_tag
else
input_iterator_tag
</pre>
</div>
<div class="section" id="indirect-iterator-requirements">
<h4><a class="toc-backref" href="#id43" name="indirect-iterator-requirements"><tt class="literal"><span class="pre">indirect_iterator</span></tt> requirements</a></h4>
@ -1337,7 +1349,7 @@ specified in the models section.</p>
Iterator. The <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> argument shall be one of the
standard iterator tags or <tt class="literal"><span class="pre">use_default</span></tt>. If <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt>
is an iterator tag, the template parameter <tt class="literal"><span class="pre">Iterator</span></tt> argument shall
meet the traversal requirements corresponding to the iterator tag.</p>
meet the requirements corresponding to the iterator tag.</p>
<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
<tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt>, must be a valid expression
and must be convertible to <tt class="literal"><span class="pre">indirect_iterator::reference</span></tt>. Also
@ -1486,9 +1498,20 @@ private:
Iterator m_iterator; // exposition
};
</pre>
<p>The <tt class="literal"><span class="pre">iterator_category</span></tt> member is a type convertible to the tags
corresponding to each standard concept modeled by
<tt class="literal"><span class="pre">reverse_iterator</span></tt>, as described in the models section.</p>
<p>The <tt class="literal"><span class="pre">iterator_category</span></tt> member is a type convertible to the iterator
tag given by the following algorithm. Let <tt class="literal"><span class="pre">T</span></tt> be
<tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt>, <tt class="literal"><span class="pre">R</span></tt> be
<tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::reference</span></tt>, and <tt class="literal"><span class="pre">C</span></tt> be
<tt class="literal"><span class="pre">traveral_category&lt;Iterator&gt;::type</span></tt>.</p>
<pre class="literal-block">
if (R is a reference to T) then
if (C is convertible to random_access_traversal_tag) then
random_access_iterator_tag
else
bidirectional_iterator_tag
else
input_iterator_tag
</pre>
</div>
<div class="section" id="reverse-iterator-requirements">
<h4><a class="toc-backref" href="#id48" name="reverse-iterator-requirements"><tt class="literal"><span class="pre">reverse_iterator</span></tt> requirements</a></h4>
@ -1664,10 +1687,21 @@ private:
</pre>
<p>The <tt class="literal"><span class="pre">reference</span></tt> type of <tt class="literal"><span class="pre">transform_iterator</span></tt> is
<tt class="literal"><span class="pre">result_of&lt;UnaryFunction(iterator_traits&lt;Iterator&gt;::reference)&gt;::type</span></tt>.
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>.
The <tt class="literal"><span class="pre">iterator_category</span></tt> member is a type convertible to the tags
corresponding to each standard concept modeled by
<tt class="literal"><span class="pre">transform_iterator</span></tt>, as described in the models section.</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>
<p>The <tt class="literal"><span class="pre">iterator_category</span></tt> member is a type convertible to the iterator
tag given by the following algorithm. Let <tt class="literal"><span class="pre">C</span></tt> be
<tt class="literal"><span class="pre">traveral_category&lt;Iterator&gt;::type</span></tt>.</p>
<pre class="literal-block">
if (reference is a reference to value_type) then
if (C is convertible to random_access_traversal_tag) then
random_access_iterator_tag
else if (C is convertible to bidirectional_traversal_tag) then
bidirectional_iterator_tag
else
forward_iterator_tag
else
input_iterator_tag
</pre>
</div>
<div class="section" id="transform-iterator-requirements">
<h4><a class="toc-backref" href="#id53" name="transform-iterator-requirements"><tt class="literal"><span class="pre">transform_iterator</span></tt> requirements</a></h4>
@ -2098,9 +2132,8 @@ integral type. Otherwise <tt class="literal"><span class="pre">difference_type</
<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
type convertible to <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&lt;Incrementable&gt;::type</span></tt>.</p>
<dl>
<dt>[<em>Note:</em> implementers are encouraged to provide an implementation of</dt>
@ -2312,7 +2345,7 @@ LocalWords: OtherIncrementable Coplien -->
<hr class="footer"/>
<div class="footer">
<a class="reference" href="facade-and-adaptor.rst">View document source</a>.
Generated on: 2004-01-13 05:14 UTC.
Generated on: 2004-01-13 05:55 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>

View File

@ -116,7 +116,7 @@ else
typedef Reference reference;
if (Value is use_default) then
typedef ?? pointer;
typedef iterator_traits&lt;V&gt;::value_type* pointer;
else
typedef Value* pointer;
@ -125,9 +125,21 @@ if (Difference is use_default)
else
typedef Difference difference_type;
</pre>
<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">indirect_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
<tt class="literal"><span class="pre">iterator_category</span></tt> is <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt>. Otherwise
<tt class="literal"><span class="pre">iterator_category</span></tt> is a type convertible to the tag determined by
the following algorithm. Let <tt class="literal"><span class="pre">C</span></tt> be <tt class="literal"><span class="pre">traveral_category&lt;Iterator&gt;::type</span></tt>.</p>
<pre class="literal-block">
if (reference is a reference to value_type) then
if (C is convertible to random_access_traversal_tag) then
random_access_iterator_tag
else if (C is convertible to bidirectional_traversal_tag) then
bidirectional_iterator_tag
else
forward_iterator_tag
else
input_iterator_tag
</pre>
</div>
<div class="section" id="indirect-iterator-requirements">
<h1><a class="toc-backref" href="#id3" name="indirect-iterator-requirements"><tt class="literal"><span class="pre">indirect_iterator</span></tt> requirements</a></h1>
@ -135,7 +147,7 @@ specified in the models section.</p>
Iterator. The <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> argument shall be one of the
standard iterator tags or <tt class="literal"><span class="pre">use_default</span></tt>. If <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt>
is an iterator tag, the template parameter <tt class="literal"><span class="pre">Iterator</span></tt> argument shall
meet the traversal requirements corresponding to the iterator tag.</p>
meet the requirements corresponding to the iterator tag.</p>
<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
<tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt>, must be a valid expression
and must be convertible to <tt class="literal"><span class="pre">indirect_iterator::reference</span></tt>. Also
@ -315,7 +327,7 @@ a,b,c,d,e,f,g,
<hr class="footer"/>
<div class="footer">
<a class="reference" href="indirect_iterator.rst">View document source</a>.
Generated on: 2004-01-13 02:54 UTC.
Generated on: 2004-01-13 05:55 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>

View File

@ -57,7 +57,7 @@ following pseudo-code. We use the abbreviation
typedef Reference reference;
if (Value is use_default) then
typedef ?? pointer;
typedef iterator_traits<V>::value_type* pointer;
else
typedef Value* pointer;
@ -67,9 +67,24 @@ following pseudo-code. We use the abbreviation
typedef Difference difference_type;
The member ``iterator_category`` is a type that satisfies the
requirements of the concepts modeled by the ``indirect_iterator`` as
specified in the models section.
If ``CategoryOrTraversal`` is not ``use_default`` then
``iterator_category`` is ``CategoryOrTraversal``. Otherwise
``iterator_category`` is a type convertible to the tag determined by
the following algorithm. Let ``C`` be ``traveral_category<Iterator>::type``.
::
if (reference is a reference to value_type) then
if (C is convertible to random_access_traversal_tag) then
random_access_iterator_tag
else if (C is convertible to bidirectional_traversal_tag) then
bidirectional_iterator_tag
else
forward_iterator_tag
else
input_iterator_tag
``indirect_iterator`` requirements
@ -79,7 +94,7 @@ The ``Iterator`` argument shall meet the requirements of Readable
Iterator. The ``CategoryOrTraversal`` argument shall be one of the
standard iterator tags or ``use_default``. If ``CategoryOrTraversal``
is an iterator tag, the template parameter ``Iterator`` argument shall
meet the traversal requirements corresponding to the iterator tag.
meet the requirements corresponding to the iterator tag.
The expression ``*v``, where ``v`` is an object of type
``iterator_traits<Iterator>::value_type``, must be a valid expression

View File

@ -80,9 +80,20 @@ private:
Iterator m_iterator; // exposition
};
</pre>
<p>The <tt class="literal"><span class="pre">iterator_category</span></tt> member is a type convertible to the tags
corresponding to each standard concept modeled by
<tt class="literal"><span class="pre">reverse_iterator</span></tt>, as described in the models section.</p>
<p>The <tt class="literal"><span class="pre">iterator_category</span></tt> member is a type convertible to the iterator
tag given by the following algorithm. Let <tt class="literal"><span class="pre">T</span></tt> be
<tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt>, <tt class="literal"><span class="pre">R</span></tt> be
<tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::reference</span></tt>, and <tt class="literal"><span class="pre">C</span></tt> be
<tt class="literal"><span class="pre">traveral_category&lt;Iterator&gt;::type</span></tt>.</p>
<pre class="literal-block">
if (R is a reference to T) then
if (C is convertible to random_access_traversal_tag) then
random_access_iterator_tag
else
bidirectional_iterator_tag
else
input_iterator_tag
</pre>
</div>
<div class="section" id="reverse-iterator-requirements">
<h1><a class="toc-backref" href="#id3" name="reverse-iterator-requirements"><tt class="literal"><span class="pre">reverse_iterator</span></tt> requirements</a></h1>
@ -266,7 +277,7 @@ sequence in double-reversed (normal) order: hello world!
<hr class="footer"/>
<div class="footer">
<a class="reference" href="reverse_iterator.rst">View document source</a>.
Generated on: 2004-01-13 02:54 UTC.
Generated on: 2004-01-13 05:39 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>

View File

@ -27,9 +27,22 @@
};
The ``iterator_category`` member is a type convertible to the tags
corresponding to each standard concept modeled by
``reverse_iterator``, as described in the models section.
The ``iterator_category`` member is a type convertible to the iterator
tag given by the following algorithm. Let ``T`` be
``iterator_traits<Iterator>::value_type``, ``R`` be
``iterator_traits<Iterator>::reference``, and ``C`` be
``traveral_category<Iterator>::type``.
::
if (R is a reference to T) then
if (C is convertible to random_access_traversal_tag) then
random_access_iterator_tag
else
bidirectional_iterator_tag
else
input_iterator_tag
``reverse_iterator`` requirements

View File

@ -90,10 +90,21 @@ private:
</pre>
<p>The <tt class="literal"><span class="pre">reference</span></tt> type of <tt class="literal"><span class="pre">transform_iterator</span></tt> is
<tt class="literal"><span class="pre">result_of&lt;UnaryFunction(iterator_traits&lt;Iterator&gt;::reference)&gt;::type</span></tt>.
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>.
The <tt class="literal"><span class="pre">iterator_category</span></tt> member is a type convertible to the tags
corresponding to each standard concept modeled by
<tt class="literal"><span class="pre">transform_iterator</span></tt>, as described in the models section.</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>
<p>The <tt class="literal"><span class="pre">iterator_category</span></tt> member is a type convertible to the iterator
tag given by the following algorithm. Let <tt class="literal"><span class="pre">C</span></tt> be
<tt class="literal"><span class="pre">traveral_category&lt;Iterator&gt;::type</span></tt>.</p>
<pre class="literal-block">
if (reference is a reference to value_type) then
if (C is convertible to random_access_traversal_tag) then
random_access_iterator_tag
else if (C is convertible to bidirectional_traversal_tag) then
bidirectional_iterator_tag
else
forward_iterator_tag
else
input_iterator_tag
</pre>
</div>
<div class="section" id="transform-iterator-requirements">
<h1><a class="toc-backref" href="#id3" name="transform-iterator-requirements"><tt class="literal"><span class="pre">transform_iterator</span></tt> requirements</a></h1>
@ -308,7 +319,7 @@ adding 4 to each element in the array:
<hr class="footer"/>
<div class="footer">
<a class="reference" href="transform_iterator.rst">View document source</a>.
Generated on: 2004-01-13 02:54 UTC.
Generated on: 2004-01-13 05:43 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>

View File

@ -38,9 +38,24 @@
The ``reference`` type of ``transform_iterator`` is
``result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type``.
The ``value_type`` is ``remove_cv<remove_reference<reference> >::type``.
The ``iterator_category`` member is a type convertible to the tags
corresponding to each standard concept modeled by
``transform_iterator``, as described in the models section.
The ``iterator_category`` member is a type convertible to the iterator
tag given by the following algorithm. Let ``C`` be
``traveral_category<Iterator>::type``.
::
if (reference is a reference to value_type) then
if (C is convertible to random_access_traversal_tag) then
random_access_iterator_tag
else if (C is convertible to bidirectional_traversal_tag) then
bidirectional_iterator_tag
else
forward_iterator_tag
else
input_iterator_tag
``transform_iterator`` requirements