forked from boostorg/iterator
Applied use of iterator-category to specialized adapters
[SVN r21745]
This commit is contained in:
@ -89,21 +89,25 @@ class counting_iterator
|
||||
Incrementable m_inc; // exposition
|
||||
};
|
||||
</pre>
|
||||
<p>If the <tt class="literal"><span class="pre">Difference</span></tt> argument is <tt class="literal"><span class="pre">use_default</span></tt> then the
|
||||
<tt class="literal"><span class="pre">difference_type</span></tt> member is an unspecified signed integral
|
||||
<p>If the <tt class="literal"><span class="pre">Difference</span></tt> argument is <tt class="literal"><span class="pre">use_default</span></tt> then
|
||||
<tt class="literal"><span class="pre">difference_type</span></tt> is an unspecified signed integral
|
||||
type. Otherwise <tt class="literal"><span class="pre">difference_type</span></tt> is <tt class="literal"><span class="pre">Difference</span></tt>.</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 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">numeric_limits<Incrementable>::is_specialized</span></tt>, then
|
||||
<tt class="literal"><span class="pre">iterator_category</span></tt> is a
|
||||
<tt class="literal"><span class="pre">facade_iterator_category(random_access_traversal_tag,</span> <span class="pre">Incrementable,</span> <span class="pre">const</span> <span class="pre">Incrementable&)</span></tt>.
|
||||
Otherwise, <tt class="literal"><span class="pre">iterator_category</span></tt> is
|
||||
<tt class="literal"><span class="pre">facade_iterator_category(iterator_traversal<Incrementable>::type,</span> <span class="pre">Incrementable,</span> <span class="pre">const</span> <span class="pre">Incrementable&)</span></tt>.</p>
|
||||
<dl>
|
||||
<dt>[<em>Note:</em> implementers are encouraged to provide an implementation of</dt>
|
||||
<dd><tt class="literal"><span class="pre">operator-</span></tt> and the default <tt class="literal"><span class="pre">difference_type</span></tt> that avoids overflows in
|
||||
the cases when the <tt class="literal"><span class="pre">Incrementable</span></tt> type is a numeric type.]</dd>
|
||||
</dl>
|
||||
<p><tt class="literal"><span class="pre">iterator_category</span></tt> is determined according to the following
|
||||
algorithm:</p>
|
||||
<pre class="literal-block">
|
||||
if (CategoryOrTraversal is not use_default)
|
||||
return CategoryOrTraversal
|
||||
else if (numeric_limits<Incrementable>::is_specialized)
|
||||
return <a class="reference" href="iterator_facade.html#iterator-category"><em>iterator-category</em></a>(
|
||||
random_access_traversal_tag, Incrementable, const Incrementable&)
|
||||
else
|
||||
return <a class="reference" href="iterator_facade.html#iterator-category"><em>iterator-category</em></a>(
|
||||
iterator_traversal<Incrementable>::type,
|
||||
Incrementable, const Incrementable&)
|
||||
</pre>
|
||||
<p>[<em>Note:</em> implementers are encouraged to provide an implementation
|
||||
of <tt class="literal"><span class="pre">operator-</span></tt> and a default <tt class="literal"><span class="pre">difference_type</span></tt> that avoid
|
||||
overflows when <tt class="literal"><span class="pre">Incrementable</span></tt> is a numeric type.]</p>
|
||||
</div>
|
||||
<div class="section" id="counting-iterator-requirements">
|
||||
<h1><a class="toc-backref" href="#id3" name="counting-iterator-requirements"><tt class="literal"><span class="pre">counting_iterator</span></tt> requirements</a></h1>
|
||||
|
Reference in New Issue
Block a user