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

@ -1318,7 +1318,7 @@ else
typedef Reference reference;
if (Value is use_default) then
typedef ?? pointer;
typedef iterator_traits<V>::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>