forked from boostorg/iterator
Fixed up definition of facade's iterator_category
fixed table widths in new-iter-concepts cross-referenced interoperability concept in iterator_facade_tutorial iterator_traversal can't satisfy UnaryTypeTrait: that's a boolean trait. [SVN r21742]
This commit is contained in:
@ -476,9 +476,9 @@ type of <tt class="literal"><span class="pre">operator*</span></tt> type be a re
|
||||
iterator.</p>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
<col width="42%" />
|
||||
<col width="14%" />
|
||||
<col width="44%" />
|
||||
<col width="22%" />
|
||||
<col width="19%" />
|
||||
<col width="59%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th colspan="3">Lvalue Iterator Requirements</th>
|
||||
@ -659,12 +659,13 @@ Forward Traversal Iterator, the following expressions are valid and
|
||||
respect the stated semantics.</p>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
<col width="35%" />
|
||||
<col width="44%" />
|
||||
<col width="21%" />
|
||||
<col width="38%" />
|
||||
<col width="37%" />
|
||||
<col width="25%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th colspan="3">Bidirectional Traversal Iterator Requirements (in addition to Forward Traversal Iterator)</th>
|
||||
<tr><th colspan="3">Bidirectional Traversal Iterator Requirements (in addition to Forward Traversal
|
||||
Iterator)</th>
|
||||
</tr>
|
||||
<tr><th>Expression</th>
|
||||
<th>Return Type</th>
|
||||
@ -715,10 +716,10 @@ the stated semantics. In the table below, <tt class="literal"><span class="pre"
|
||||
constant object of type <tt class="literal"><span class="pre">Distance</span></tt>.</p>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
<col width="31%" />
|
||||
<col width="35%" />
|
||||
<col width="18%" />
|
||||
<col width="16%" />
|
||||
<col width="28%" />
|
||||
<col width="30%" />
|
||||
<col width="23%" />
|
||||
<col width="20%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th colspan="4">Random Access Traversal Iterator Requirements (in addition to Bidirectional Traversal Iterator)</th>
|
||||
@ -831,9 +832,9 @@ of type <tt class="literal"><span class="pre">X</span></tt>, <tt class="literal"
|
||||
constant object of type <tt class="literal"><span class="pre">Distance</span></tt>.</p>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
<col width="30%" />
|
||||
<col width="34%" />
|
||||
<col width="36%" />
|
||||
<col width="13%" />
|
||||
<col width="27%" />
|
||||
<col width="60%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th>Expression</th>
|
||||
@ -872,43 +873,38 @@ constant object of type <tt class="literal"><span class="pre">Distance</span></t
|
||||
the following additional requirements must be met.</p>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
<col width="31%" />
|
||||
<col width="35%" />
|
||||
<col width="18%" />
|
||||
<col width="16%" />
|
||||
<col width="12%" />
|
||||
<col width="25%" />
|
||||
<col width="23%" />
|
||||
<col width="41%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th>Expression</th>
|
||||
<th>Return Type</th>
|
||||
<th>Operational Semantics</th>
|
||||
<th>Assertion/
|
||||
Precondition</th>
|
||||
<th>Assertion/ Precondition</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr><td><tt class="literal"><span class="pre">x</span> <span class="pre"><</span> <span class="pre">y</span></tt></td>
|
||||
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">y</span> <span class="pre">-</span> <span class="pre">x</span> <span class="pre">></span> <span class="pre">0</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre"><</span></tt> is a total
|
||||
ordering relation</td>
|
||||
<td><tt class="literal"><span class="pre"><</span></tt> is a total ordering relation</td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">y</span> <span class="pre"><</span> <span class="pre">x</span></tt></td>
|
||||
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">x</span> <span class="pre">-</span> <span class="pre">y</span> <span class="pre">></span> <span class="pre">0</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre"><</span></tt> is a total
|
||||
ordering relation</td>
|
||||
<td><tt class="literal"><span class="pre"><</span></tt> is a total ordering relation</td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">x</span> <span class="pre">></span> <span class="pre">y</span></tt></td>
|
||||
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">y</span> <span class="pre"><</span> <span class="pre">x</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">></span></tt> is a total
|
||||
ordering relation</td>
|
||||
<td><tt class="literal"><span class="pre">></span></tt> is a total ordering relation</td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">y</span> <span class="pre">></span> <span class="pre">x</span></tt></td>
|
||||
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">x</span> <span class="pre"><</span> <span class="pre">y</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">></span></tt> is a total
|
||||
ordering relation</td>
|
||||
<td><tt class="literal"><span class="pre">></span></tt> is a total ordering relation</td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">x</span> <span class="pre">>=</span> <span class="pre">y</span></tt></td>
|
||||
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
|
||||
@ -933,20 +929,16 @@ ordering relation</td>
|
||||
<tr><td><tt class="literal"><span class="pre">y</span> <span class="pre">-</span> <span class="pre">x</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">Distance</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">distance(Y(x),y)</span></tt></td>
|
||||
<td>pre: there exists a
|
||||
value <tt class="literal"><span class="pre">n</span></tt> of
|
||||
<tt class="literal"><span class="pre">Distance</span></tt> such that
|
||||
<tt class="literal"><span class="pre">x</span> <span class="pre">+</span> <span class="pre">n</span> <span class="pre">==</span> <span class="pre">y</span></tt>. <tt class="literal"><span class="pre">y</span>
|
||||
<span class="pre">==</span> <span class="pre">x</span> <span class="pre">+</span> <span class="pre">(y</span> <span class="pre">-</span> <span class="pre">x)</span></tt>.</td>
|
||||
<td>pre: there exists a value <tt class="literal"><span class="pre">n</span></tt> of
|
||||
<tt class="literal"><span class="pre">Distance</span></tt> such that <tt class="literal"><span class="pre">x</span> <span class="pre">+</span> <span class="pre">n</span> <span class="pre">==</span> <span class="pre">y</span></tt>.
|
||||
<tt class="literal"><span class="pre">y</span> <span class="pre">==</span> <span class="pre">x</span> <span class="pre">+</span> <span class="pre">(y</span> <span class="pre">-</span> <span class="pre">x)</span></tt>.</td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">x</span> <span class="pre">-</span> <span class="pre">y</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">Distance</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">distance(y,Y(x))</span></tt></td>
|
||||
<td>pre: there exists a
|
||||
value <tt class="literal"><span class="pre">n</span></tt> of
|
||||
<tt class="literal"><span class="pre">Distance</span></tt> such that
|
||||
<tt class="literal"><span class="pre">y</span> <span class="pre">+</span> <span class="pre">n</span> <span class="pre">==</span> <span class="pre">x</span></tt>. <tt class="literal"><span class="pre">x</span>
|
||||
<span class="pre">==</span> <span class="pre">y</span> <span class="pre">+</span> <span class="pre">(x</span> <span class="pre">-</span> <span class="pre">y)</span></tt>.</td>
|
||||
<td>pre: there exists a value <tt class="literal"><span class="pre">n</span></tt> of
|
||||
<tt class="literal"><span class="pre">Distance</span></tt> such that <tt class="literal"><span class="pre">y</span> <span class="pre">+</span> <span class="pre">n</span> <span class="pre">==</span> <span class="pre">x</span></tt>.
|
||||
<tt class="literal"><span class="pre">x</span> <span class="pre">==</span> <span class="pre">y</span> <span class="pre">+</span> <span class="pre">(x</span> <span class="pre">-</span> <span class="pre">y)</span></tt>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -969,27 +961,30 @@ struct random_access_traversal_tag : bidirectional_traversal_tag { };
|
||||
</div>
|
||||
<div class="section" id="addition-to-lib-iterator-traits">
|
||||
<h2><a class="toc-backref" href="#id23" name="addition-to-lib-iterator-traits">Addition to [lib.iterator.traits]</a></h2>
|
||||
<p>The <tt class="literal"><span class="pre">is_readable_iterator</span></tt> and <tt class="literal"><span class="pre">iterator_traversal</span></tt> class
|
||||
templates satisfy the <a class="reference" href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1519.htm">UnaryTypeTrait</a> requirements.</p>
|
||||
<p>The <tt class="literal"><span class="pre">is_readable_iterator</span></tt> class
|
||||
template satisfies the <a class="reference" href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1519.htm">UnaryTypeTrait</a> requirements.</p>
|
||||
<p>Given an iterator type <tt class="literal"><span class="pre">X</span></tt>, <tt class="literal"><span class="pre">is_readable_iterator<X>::value</span></tt>
|
||||
yields <tt class="literal"><span class="pre">true</span></tt> if, for an object <tt class="literal"><span class="pre">a</span></tt> of type <tt class="literal"><span class="pre">X</span></tt>, <tt class="literal"><span class="pre">*a</span></tt> is
|
||||
convertible to <tt class="literal"><span class="pre">iterator_traits<X>::value_type</span></tt>, and <tt class="literal"><span class="pre">false</span></tt>
|
||||
otherwise.</p>
|
||||
<p><tt class="literal"><span class="pre">iterator_traversal<X>::type</span></tt> is defined to be:</p>
|
||||
<p><tt class="literal"><span class="pre">iterator_traversal<X>::type</span></tt> is</p>
|
||||
<pre class="literal-block">
|
||||
traversal-category(X) =
|
||||
cat = iterator_traits<X>::iterator_category;
|
||||
if (cat is convertible to incrementable_traversal_tag)
|
||||
return cat;
|
||||
else if (cat is convertible to random_access_iterator_tag)
|
||||
<em>category-to-traversal</em>(iterator_traits<X>::iterator_category)
|
||||
</pre>
|
||||
<p>where <em>category-to-traversal</em> is defined as follows</p>
|
||||
<a class="target" id="category-to-traversal" name="category-to-traversal"></a><pre class="literal-block">
|
||||
<em>category-to-traversal</em>(C) =
|
||||
if (C is convertible to incrementable_traversal_tag)
|
||||
return C;
|
||||
else if (C is convertible to random_access_iterator_tag)
|
||||
return random_access_traversal_tag;
|
||||
else if (cat is convertible to bidirectional_iterator_tag)
|
||||
else if (C is convertible to bidirectional_iterator_tag)
|
||||
return bidirectional_traversal_tag;
|
||||
else if (cat is convertible to forward_iterator_tag)
|
||||
else if (C is convertible to forward_iterator_tag)
|
||||
return forward_traversal_tag;
|
||||
else if (cat is convertible to input_iterator_tag)
|
||||
else if (C is convertible to input_iterator_tag)
|
||||
return single_pass_traversal_tag;
|
||||
else if (cat is convertible to output_iterator_tag)
|
||||
else if (C is convertible to output_iterator_tag)
|
||||
return incrementable_traversal_tag;
|
||||
else
|
||||
<em>the program is ill-formed</em>
|
||||
|
Reference in New Issue
Block a user