mirror of
https://github.com/boostorg/utility.git
synced 2025-08-02 14:24:30 +02:00
changed named parameters doc to match new stuff
[SVN r11417]
This commit is contained in:
@@ -131,11 +131,11 @@
|
|||||||
<p><tt>iterator_adaptor</tt> is declared like this:
|
<p><tt>iterator_adaptor</tt> is declared like this:
|
||||||
<pre>
|
<pre>
|
||||||
template <class Base, class Policies,
|
template <class Base, class Policies,
|
||||||
class ValueOrNamedParams = typename std::iterator_traits<Base>::value_type,
|
class ValueOrNamedParam = typename std::iterator_traits<Base>::value_type,
|
||||||
class ReferenceOrNamedParams = <i>...(see below)</i>,
|
class ReferenceOrNamedParam = <i>...(see below)</i>,
|
||||||
class PointerOrNamedParams = <i>...(see below)</i>,
|
class PointerOrNamedParam = <i>...(see below)</i>,
|
||||||
class CategoryOrNamedParams = typename std::iterator_traits<Base>::iterator_category,
|
class CategoryOrNamedParam = typename std::iterator_traits<Base>::iterator_category,
|
||||||
class DistanceOrNamedParams = typename std::iterator_traits<Base>::difference_type>
|
class DistanceOrNamedParam = typename std::iterator_traits<Base>::difference_type>
|
||||||
struct iterator_adaptor;
|
struct iterator_adaptor;
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
@@ -208,11 +208,9 @@ struct iterator_adaptor;
|
|||||||
<tt>std::iterator_traits<BaseType>::difference_type</tt>
|
<tt>std::iterator_traits<BaseType>::difference_type</tt>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><tt>NamedParams</tt>
|
<td><tt>NamedParam</tt>
|
||||||
|
|
||||||
<td>A list of named template parameters generated using the
|
<td>A named template parameter (see below).
|
||||||
<a href="#iterator_traits_generator">
|
|
||||||
<tt>iterator_traits_generator</tt></a> class (see below).
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h3><a name="named_template_parameters">Named Template Parameters</a></h3>
|
<h3><a name="named_template_parameters">Named Template Parameters</a></h3>
|
||||||
@@ -223,59 +221,32 @@ struct iterator_adaptor;
|
|||||||
template parameter, but use the defaults for the third through
|
template parameter, but use the defaults for the third through
|
||||||
fifth. As a solution to these problems we provide a mechanism for
|
fifth. As a solution to these problems we provide a mechanism for
|
||||||
naming the last five template parameters, and providing them in
|
naming the last five template parameters, and providing them in
|
||||||
any order through the <tt>iterator_traits_generator</tt> class.
|
any order through a set of named template parameters. The following
|
||||||
|
classes are provided for specifying the parameters. Any of these
|
||||||
|
classes can be used for any of the last five template parameters
|
||||||
|
of <tt>iterator_adaptor</tt>.
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<pre>
|
<pre>
|
||||||
<a name="iterator_traits_generator">class iterator_traits_generator</a>
|
template <class Value> struct value_type_is;
|
||||||
{
|
template <class Reference> struct reference_is;
|
||||||
public:
|
template <class Pointer> struct pointer_is;
|
||||||
template <class Value>
|
template <class Distance> struct difference_type_is;
|
||||||
struct value_type : public <i>recursive magic</i> { };
|
template <class Category> struct iterator_category_is;
|
||||||
|
|
||||||
template <class Reference>
|
|
||||||
struct reference : public <i>recursive magic</i> { };
|
|
||||||
|
|
||||||
template <class Pointer>
|
|
||||||
struct pointer : public <i>recursive magic</i> { };
|
|
||||||
|
|
||||||
template <class Distance>
|
|
||||||
struct difference_type : public <i>recursive magic</i> { };
|
|
||||||
|
|
||||||
template <class Category>
|
|
||||||
struct iterator_category : public <i>recursive magic</i> { };
|
|
||||||
};
|
|
||||||
</pre>
|
</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
The <tt>iterator_traits_generator</tt> is used to create a list of
|
For example, the following adapts <tt>foo_iterator</tt> to create
|
||||||
of template arguments. For example, suppose you want to set the
|
an <a href=
|
||||||
<tt>Reference</tt> and <tt>Category</tt> parameters, and use the
|
"http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>
|
||||||
defaults for the rest. Then you can use the traits generator as
|
with <tt>reference</tt> type <tt>foo</tt>, and whose other traits
|
||||||
follows:
|
are determined according to the defaults described <a
|
||||||
|
href="#template_parameters">above</a>.
|
||||||
|
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<pre>
|
<pre>
|
||||||
iterator_traits_generator::reference<foo>::category<std::input_iterator_tag>
|
typedef iterator_adaptor<foo_iterator, foo_policies,
|
||||||
</pre>
|
reference_is<foo>, iterator_category_is<std::input_iterator_tag>
|
||||||
</blockquote>
|
> MyIterator;
|
||||||
|
|
||||||
This generated type can then be passed into the <tt>iterator_adaptor</tt>
|
|
||||||
class to replace any of the last five parameters. If you use the traits
|
|
||||||
generator in the <i>i</i>th parameter position, then the parameters <i>i</i>
|
|
||||||
through 7 will use the types specified in the generator. For example, the
|
|
||||||
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>
|
|
||||||
<pre>
|
|
||||||
iterator_adaptor<foo_iterator, foo_policies,
|
|
||||||
iterator_traits_generator
|
|
||||||
::reference<foo>
|
|
||||||
::iterator_category<std::input_iterator_tag>
|
|
||||||
>
|
|
||||||
</pre>
|
</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user