mirror of
https://github.com/boostorg/utility.git
synced 2025-07-30 04:47:30 +02:00
Mostly clarification. Fix: changed "category" to "iterator_category" in one place.
[SVN r9517]
This commit is contained in:
@ -65,7 +65,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
Specialized Iterator Adaptors
|
<a name="specialized_adaptors">Specialized Iterator Adaptors</a>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="indirect_iterator.htm">Indirect Iterator Adaptor</a>
|
<li><a href="indirect_iterator.htm">Indirect Iterator Adaptor</a>
|
||||||
@ -261,18 +261,21 @@ iterator_traits_generator::reference<foo>::category<std::input_iterator
|
|||||||
</pre>
|
</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
This generated type can then be passed into the
|
This generated type can then be passed into the <tt>iterator_adaptor</tt>
|
||||||
<tt>iterator_adaptor</tt> class to replace any of the last five
|
class to replace any of the last five parameters. If you use the traits
|
||||||
parameters. If you use the traits generator in the <i>i</i>th
|
generator in the <i>i</i>th parameter position, then the parameters <i>i</i>
|
||||||
parameter position, then the parameters <i>i</i> through 7 will
|
through 7 will use the types specified in the generator. For example, the
|
||||||
use the types specified in the generator.
|
following adapts <tt>foo_iterator</tt> to create an <a href=
|
||||||
|
"http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a> with
|
||||||
|
<tt>reference</tt> type <tt>foo</tt>, and whose other traits are determined
|
||||||
|
according to the defaults described <a href="#template_parameters">above</a>.
|
||||||
|
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<pre>
|
<pre>
|
||||||
iterator_adaptor<foo_iterator, foo_policies,
|
iterator_adaptor<foo_iterator, foo_policies,
|
||||||
iterator_traits_generator
|
iterator_traits_generator
|
||||||
::reference<foo>
|
::reference<foo>
|
||||||
::category<std::input_iterator_tag>
|
::iterator_category<std::input_iterator_tag>
|
||||||
>
|
>
|
||||||
</pre>
|
</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
@ -281,22 +284,22 @@ iterator_adaptor<foo_iterator, foo_policies,
|
|||||||
<h3><a name="policies">The Policies Class</a></h3>
|
<h3><a name="policies">The Policies Class</a></h3>
|
||||||
|
|
||||||
<p>The main task in using <tt>iterator_adaptor</tt> is creating an
|
<p>The main task in using <tt>iterator_adaptor</tt> is creating an
|
||||||
appropriate <tt>Policies</tt> class. The <tt>Policies</tt> class will
|
appropriate <tt>Policies</tt> class. The <tt>Policies</tt> class will become
|
||||||
become the functional heart of the iterator adaptor, supplying the core
|
the functional heart of the resulting iterator, supplying the core
|
||||||
iterator operations that will determine how your new adaptor class will
|
operations that determine its behavior. The <tt>iterator_adaptor</tt>
|
||||||
behave. The <tt>iterator_adaptor</tt> template defines all of the operators
|
template defines all of the operators required of a <a href=
|
||||||
required of a <a href=
|
|
||||||
"http://www.sgi.com/tech/stl/RandomAccessIterator.html">Random Access
|
"http://www.sgi.com/tech/stl/RandomAccessIterator.html">Random Access
|
||||||
Iterator</a>. Your <tt>Policies</tt> class must implement three, four, or
|
Iterator</a> by dispatching to a <tt>Policies</tt> object. Your
|
||||||
seven of the core iterator operations below depending on the iterator
|
<tt>Policies</tt> class must implement a subset of the core iterator
|
||||||
categories you want it to support.<br>
|
operations below corresponding to the iterator categories you want it to
|
||||||
|
support.<br>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|
||||||
<table border="1" summary="iterator_adaptor Policies operations">
|
<table border="1" summary="iterator_adaptor Policies operations">
|
||||||
<caption>
|
<caption>
|
||||||
<b>Core Iterator Operations</b><br>
|
<b>Core Iterator Operations</b><br>
|
||||||
<tt>T</tt>: iterator type; <tt>p</tt>: object of type T; <tt>n</tt>: <tt>T::size_type</tt>; <tt>x</tt>: <tt>T::difference_type</tt>; <tt>p1</tt>, <tt>p2</tt>: iterators
|
<tt>T</tt>: adapted iterator type; <tt>p</tt>: object of type T; <tt>n</tt>: <tt>T::size_type</tt>; <tt>x</tt>: <tt>T::difference_type</tt>; <tt>p1</tt>, <tt>p2</tt>: iterators
|
||||||
</caption>
|
</caption>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
@ -439,7 +442,8 @@ struct <a name="default_iterator_policies">default_iterator_policies</a>
|
|||||||
range of iterators. If we had used concrete types above, we'd have tied the
|
range of iterators. If we had used concrete types above, we'd have tied the
|
||||||
usefulness of <tt>default_iterator_policies</tt> to a particular range of
|
usefulness of <tt>default_iterator_policies</tt> to a particular range of
|
||||||
adapted iterators. If you follow the same pattern with your
|
adapted iterators. If you follow the same pattern with your
|
||||||
<tt>Policies</tt> classes, you may achieve the same sort of reusability.
|
<tt>Policies</tt> classes, you can use them to generate more specialized
|
||||||
|
adaptors along the lines of <a href="#specialized_adaptors">those supplied by this library</a>.
|
||||||
|
|
||||||
<h3><a name="additional_members">Additional Members</a></h3>
|
<h3><a name="additional_members">Additional Members</a></h3>
|
||||||
In addition to all of the member functions required of a <a href=
|
In addition to all of the member functions required of a <a href=
|
||||||
|
Reference in New Issue
Block a user