mirror of
https://github.com/boostorg/iterator.git
synced 2025-07-29 20:37:17 +02:00
changed algorithm for iterator_facade::iterator_category
and for filter_iterator [SVN r21686]
This commit is contained in:
@ -814,24 +814,19 @@ if (R is a reference type
|
||||
&& C is convertible to forward_traversal_tag)
|
||||
{
|
||||
if (C is convertible to random_access_traversal_tag)
|
||||
return random_access_iterator_tag
|
||||
random_access_iterator_tag
|
||||
else if (C is convertible to bidirectional_traversal_tag)
|
||||
return bidirectional_iterator_tag
|
||||
bidirectional_iterator_tag
|
||||
else
|
||||
return forward_traversal_tag
|
||||
forward_iterator_tag
|
||||
}
|
||||
else
|
||||
{
|
||||
if (C is convertible to single_pass_traversal_tag
|
||||
&& R is convertible to V)
|
||||
{
|
||||
if (V is const)
|
||||
return input_iterator_tag
|
||||
else
|
||||
return input_iterator_tag and output_iterator_tag
|
||||
}
|
||||
input_iterator_tag
|
||||
else
|
||||
return output_iterator_tag
|
||||
C
|
||||
}
|
||||
</pre>
|
||||
</li>
|
||||
@ -1892,15 +1887,10 @@ private:
|
||||
Iterator m_end; // exposition only
|
||||
};
|
||||
</pre>
|
||||
<p>If <tt class="literal"><span class="pre">iterator_traits<Iterator>::reference</span></tt> is a reference to
|
||||
<tt class="literal"><span class="pre">iterator_traits<Iterator>::value_type</span></tt> and
|
||||
<tt class="literal"><span class="pre">iterator_traversal<Iterator>::type</span></tt> is convertible to
|
||||
<tt class="literal"><span class="pre">forward_traversal_tag</span></tt> then the <tt class="literal"><span class="pre">iterator_category</span></tt> member is a
|
||||
type convertible to <tt class="literal"><span class="pre">forward_iterator_tag</span></tt>. Otherwise
|
||||
<tt class="literal"><span class="pre">iterator_category</span></tt> is a type convertible to
|
||||
<tt class="literal"><span class="pre">input_iterator_tag</span></tt>.</p>
|
||||
<!-- In that last case, I think the implementation produces a tag
|
||||
convertible to both input and output, which seems wrong. -JGS -->
|
||||
<p>If <tt class="literal"><span class="pre">Iterator</span></tt> models Readable Lvalue Iterator and Forward Traversal
|
||||
Iterator then <tt class="literal"><span class="pre">iterator_category</span></tt> is convertible to
|
||||
<tt class="literal"><span class="pre">std::forward_iterator_tag</span></tt>. Otherwise <tt class="literal"><span class="pre">iterator_category</span></tt> is
|
||||
convertible to <tt class="literal"><span class="pre">std::input_iterator_tag</span></tt>.</p>
|
||||
</div>
|
||||
<div class="section" id="filter-iterator-requirements">
|
||||
<h4><a class="toc-backref" href="#id58" name="filter-iterator-requirements"><tt class="literal"><span class="pre">filter_iterator</span></tt> requirements</a></h4>
|
||||
@ -2350,7 +2340,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 14:26 UTC.
|
||||
Generated on: 2004-01-13 18:07 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>
|
||||
|
@ -91,15 +91,10 @@ private:
|
||||
Iterator m_end; // exposition only
|
||||
};
|
||||
</pre>
|
||||
<p>If <tt class="literal"><span class="pre">iterator_traits<Iterator>::reference</span></tt> is a reference to
|
||||
<tt class="literal"><span class="pre">iterator_traits<Iterator>::value_type</span></tt> and
|
||||
<tt class="literal"><span class="pre">iterator_traversal<Iterator>::type</span></tt> is convertible to
|
||||
<tt class="literal"><span class="pre">forward_traversal_tag</span></tt> then the <tt class="literal"><span class="pre">iterator_category</span></tt> member is a
|
||||
type convertible to <tt class="literal"><span class="pre">forward_iterator_tag</span></tt>. Otherwise
|
||||
<tt class="literal"><span class="pre">iterator_category</span></tt> is a type convertible to
|
||||
<tt class="literal"><span class="pre">input_iterator_tag</span></tt>.</p>
|
||||
<!-- In that last case, I think the implementation produces a tag
|
||||
convertible to both input and output, which seems wrong. -JGS -->
|
||||
<p>If <tt class="literal"><span class="pre">Iterator</span></tt> models Readable Lvalue Iterator and Forward Traversal
|
||||
Iterator then <tt class="literal"><span class="pre">iterator_category</span></tt> is convertible to
|
||||
<tt class="literal"><span class="pre">std::forward_iterator_tag</span></tt>. Otherwise <tt class="literal"><span class="pre">iterator_category</span></tt> is
|
||||
convertible to <tt class="literal"><span class="pre">std::input_iterator_tag</span></tt>.</p>
|
||||
</div>
|
||||
<div class="section" id="filter-iterator-requirements">
|
||||
<h1><a class="toc-backref" href="#id3" name="filter-iterator-requirements"><tt class="literal"><span class="pre">filter_iterator</span></tt> requirements</a></h1>
|
||||
@ -383,7 +378,7 @@ int main()
|
||||
<hr class="footer" />
|
||||
<div class="footer">
|
||||
<a class="reference" href="filter_iterator.rst">View document source</a>.
|
||||
Generated on: 2004-01-13 15:59 UTC.
|
||||
Generated on: 2004-01-13 18:08 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>
|
||||
|
@ -30,16 +30,10 @@
|
||||
};
|
||||
|
||||
|
||||
If ``iterator_traits<Iterator>::reference`` is a reference to
|
||||
``iterator_traits<Iterator>::value_type`` and
|
||||
``iterator_traversal<Iterator>::type`` is convertible to
|
||||
``forward_traversal_tag`` then the ``iterator_category`` member is a
|
||||
type convertible to ``forward_iterator_tag``. Otherwise
|
||||
``iterator_category`` is a type convertible to
|
||||
``input_iterator_tag``.
|
||||
|
||||
.. In that last case, I think the implementation produces a tag
|
||||
convertible to both input and output, which seems wrong. -JGS
|
||||
If ``Iterator`` models Readable Lvalue Iterator and Forward Traversal
|
||||
Iterator then ``iterator_category`` is convertible to
|
||||
``std::forward_iterator_tag``. Otherwise ``iterator_category`` is
|
||||
convertible to ``std::input_iterator_tag``.
|
||||
|
||||
|
||||
``filter_iterator`` requirements
|
||||
|
@ -486,24 +486,19 @@ if (R is a reference type
|
||||
&& C is convertible to forward_traversal_tag)
|
||||
{
|
||||
if (C is convertible to random_access_traversal_tag)
|
||||
return random_access_iterator_tag
|
||||
random_access_iterator_tag
|
||||
else if (C is convertible to bidirectional_traversal_tag)
|
||||
return bidirectional_iterator_tag
|
||||
bidirectional_iterator_tag
|
||||
else
|
||||
return forward_traversal_tag
|
||||
forward_iterator_tag
|
||||
}
|
||||
else
|
||||
{
|
||||
if (C is convertible to single_pass_traversal_tag
|
||||
&& R is convertible to V)
|
||||
{
|
||||
if (V is const)
|
||||
return input_iterator_tag
|
||||
else
|
||||
return input_iterator_tag and output_iterator_tag
|
||||
}
|
||||
input_iterator_tag
|
||||
else
|
||||
return output_iterator_tag
|
||||
C
|
||||
}
|
||||
</pre>
|
||||
</li>
|
||||
@ -1137,7 +1132,7 @@ even be superior.</p>
|
||||
<hr class="footer" />
|
||||
<div class="footer">
|
||||
<a class="reference" href="iterator_facade.rst">View document source</a>.
|
||||
Generated on: 2004-01-13 14:25 UTC.
|
||||
Generated on: 2004-01-13 18:05 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>
|
||||
|
@ -192,24 +192,19 @@ is a type which satisfies the following conditions:
|
||||
&& C is convertible to forward_traversal_tag)
|
||||
{
|
||||
if (C is convertible to random_access_traversal_tag)
|
||||
return random_access_iterator_tag
|
||||
random_access_iterator_tag
|
||||
else if (C is convertible to bidirectional_traversal_tag)
|
||||
return bidirectional_iterator_tag
|
||||
bidirectional_iterator_tag
|
||||
else
|
||||
return forward_traversal_tag
|
||||
forward_iterator_tag
|
||||
}
|
||||
else
|
||||
{
|
||||
if (C is convertible to single_pass_traversal_tag
|
||||
&& R is convertible to V)
|
||||
{
|
||||
if (V is const)
|
||||
return input_iterator_tag
|
||||
else
|
||||
return input_iterator_tag and output_iterator_tag
|
||||
}
|
||||
input_iterator_tag
|
||||
else
|
||||
return output_iterator_tag
|
||||
C
|
||||
}
|
||||
|
||||
- ``iterator_traversal<X>::type`` is convertible to the most
|
||||
|
Reference in New Issue
Block a user