added pseudo-code for facade_iterator_category type function

[SVN r21736]
This commit is contained in:
Jeremy Siek
2004-01-14 19:57:11 +00:00
parent 731576fbfe
commit 2854c5c761
10 changed files with 277 additions and 434 deletions

View File

@ -125,57 +125,10 @@ if (Difference is use_default)
else
typedef Difference difference_type;
</pre>
<p><tt class="literal"><span class="pre">iterator_category</span></tt> satisfies the following conditions, where
<tt class="literal"><span class="pre">R</span></tt> is <tt class="literal"><span class="pre">reference</span></tt> and <tt class="literal"><span class="pre">V</span></tt> is <tt class="literal"><span class="pre">value_type</span></tt>, and where: if
<tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> is <tt class="literal"><span class="pre">use_default</span></tt>, <tt class="literal"><span class="pre">C</span></tt> is
<tt class="literal"><span class="pre">iterator_traversal&lt;Iterator&gt;::type</span></tt> and otherwise <tt class="literal"><span class="pre">C</span></tt> is
<tt class="literal"><span class="pre">CategoryOrTraversal</span></tt>.</p>
<blockquote>
<ul>
<li><p class="first">if <tt class="literal"><span class="pre">C</span></tt> is convertible to <tt class="literal"><span class="pre">std::input_iterator_tag</span></tt> or
<tt class="literal"><span class="pre">C</span></tt> is convertible to <tt class="literal"><span class="pre">std::output_iterator_tag</span></tt>,
<tt class="literal"><span class="pre">iterator_category</span></tt> is the same as <tt class="literal"><span class="pre">C</span></tt>.</p>
</li>
<li><p class="first">Otherwise, if <tt class="literal"><span class="pre">C</span></tt> is not convertible to
<tt class="literal"><span class="pre">incrementable_traversal_tag</span></tt>, the program is ill-formed</p>
</li>
<li><p class="first">Otherwise:</p>
<ul>
<li><p class="first"><tt class="literal"><span class="pre">iterator_category</span></tt> is convertible to the iterator
category tag or tags given by the following algorithm, and
not to any more-derived iterator category tag or tags:</p>
<pre class="literal-block">
if (R is a reference type
&amp;&amp; C is convertible to forward_traversal_tag)
{
if (C is convertible to random_access_traversal_tag)
random_access_iterator_tag
else if (C is convertible to bidirectional_traversal_tag)
bidirectional_iterator_tag
else
forward_iterator_tag
}
else
{
if (C is convertible to single_pass_traversal_tag
&amp;&amp; R is convertible to V)
input_iterator_tag
else
C
}
</pre>
</li>
<li><p class="first"><tt class="literal"><span class="pre">iterator_traversal&lt;X&gt;::type</span></tt> is convertible to the most
derived traversal tag type to which <tt class="literal"><span class="pre">C</span></tt> is also
convertible, and not to any more-derived traversal tag type.</p>
</li>
</ul>
</li>
</ul>
<!-- Copyright David Abrahams 2004. Use, modification and distribution is -->
<!-- subject to the Boost Software License, Version 1.0. (See accompanying -->
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
</blockquote>
<p>The <tt class="literal"><span class="pre">iterator_category</span></tt> member is <tt class="literal"><span class="pre">facade_iterator_category(C,</span>
<span class="pre">value_type,</span> <span class="pre">reference)</span></tt> where if <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> is
<tt class="literal"><span class="pre">use_default</span></tt>, <tt class="literal"><span class="pre">C</span></tt> is <tt class="literal"><span class="pre">iterator_traversal&lt;Iterator&gt;::type</span></tt> and
otherwise <tt class="literal"><span class="pre">C</span></tt> is <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt>.</p>
</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>