mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-12 14:01:37 +00:00
Fixed license & copyright issues and converted to HTML 4.01
[SVN r36280]
This commit is contained in:
parent
bb27f3ee25
commit
7bb83d4646
@ -1,33 +1,37 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Generator Iterator Adaptor Documentation</title>
|
||||
<meta http-equiv="Content-Language" content="en-us">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
||||
|
||||
<title>Generator Iterator Adaptor Documentation</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF" text="#000000">
|
||||
<img src="../../boost.png" alt="boost.png (6897 bytes)" align="middle"
|
||||
width="277" height="86">
|
||||
|
||||
<img src="../../boost.png" alt="boost.png (6897 bytes)" align="center" width="277" height="86">
|
||||
<h1>Generator Iterator Adaptor</h1>
|
||||
|
||||
<h1>Generator Iterator Adaptor</h1>
|
||||
Defined in header <a href="../../boost/generator_iterator.hpp">boost/generator_iterator.hpp</a>
|
||||
<p>
|
||||
The generator iterator adaptor makes it easier to create custom input
|
||||
iterators from 0-ary functions and function objects. The adaptor
|
||||
takes a
|
||||
<a href="http://www.sgi.com/tech/stl/Generator.html">Generator</a>
|
||||
and creates a model of
|
||||
<a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>.
|
||||
Each increment retrieves an item from the generator and makes it
|
||||
available to be retrieved by dereferencing. The motivation for this
|
||||
iterator is that some concepts can be more naturally expressed as a
|
||||
generator, while most STL algorithms expect an iterator. An example
|
||||
is the <a href="../random/index.html">Random Number</a> library.
|
||||
<p>Defined in header <a href=
|
||||
"../../boost/generator_iterator.hpp">boost/generator_iterator.hpp</a></p>
|
||||
|
||||
<h2>Synopsis</h2>
|
||||
<p>The generator iterator adaptor makes it easier to create custom input
|
||||
iterators from 0-ary functions and function objects. The adaptor takes a
|
||||
<a href="http://www.sgi.com/tech/stl/Generator.html">Generator</a> and
|
||||
creates a model of <a href=
|
||||
"http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>. Each
|
||||
increment retrieves an item from the generator and makes it available to be
|
||||
retrieved by dereferencing. The motivation for this iterator is that some
|
||||
concepts can be more naturally expressed as a generator, while most STL
|
||||
algorithms expect an iterator. An example is the <a href=
|
||||
"../random/index.html">Random Number</a> library.</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>
|
||||
<h2>Synopsis</h2>
|
||||
|
||||
<blockquote>
|
||||
<pre>
|
||||
namespace boost {
|
||||
template <class Generator>
|
||||
class generator_iterator_policies;
|
||||
@ -40,21 +44,19 @@ namespace boost {
|
||||
make_generator_iterator(Generator & gen);
|
||||
}
|
||||
</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<hr>
|
||||
|
||||
<hr>
|
||||
<h2>The Generator Iterator Generator Class</h2>
|
||||
|
||||
<h2>The Generator Iterator Generator Class</h2>
|
||||
|
||||
The class generator_iterator_generator is a helper class whose purpose
|
||||
is to construct a generator iterator type. The template parameter for
|
||||
this class is the Generator function object type that is being
|
||||
wrapped. The generator iterator adaptor only holds a reference (or
|
||||
pointer) to the function object, therefore the function object must
|
||||
outlive the generator iterator adaptor constructed from it.
|
||||
|
||||
<pre>
|
||||
template <class Generator>
|
||||
<p>The class generator_iterator_generator is a helper class whose purpose
|
||||
is to construct a generator iterator type. The template parameter for this
|
||||
class is the Generator function object type that is being wrapped. The
|
||||
generator iterator adaptor only holds a reference (or pointer) to the
|
||||
function object, therefore the function object must outlive the generator
|
||||
iterator adaptor constructed from it.</p>
|
||||
<pre>
|
||||
template <class Generator>
|
||||
class generator_iterator_generator
|
||||
{
|
||||
public:
|
||||
@ -62,65 +64,65 @@ public:
|
||||
}
|
||||
</pre>
|
||||
|
||||
<h3>Template Parameters</h3>
|
||||
|
||||
<h3>Template Parameters</h3>
|
||||
<table border summary="">
|
||||
<tr>
|
||||
<th>Parameter</th>
|
||||
|
||||
<table border>
|
||||
<tr>
|
||||
<th>Parameter</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><tt><a href="http://www.sgi.com/tech/stl/Generator.html">Generator</a></tt>
|
||||
<td>The generator (0-ary function object) type being
|
||||
wrapped. The return type of the function must be defined as
|
||||
<tt>Generator::result_type</tt>. The function object must be a model
|
||||
of
|
||||
<a href="http://www.sgi.com/tech/stl/Generator.html">Generator</a>.
|
||||
</td>
|
||||
</table>
|
||||
<tr>
|
||||
<td><tt><a href=
|
||||
"http://www.sgi.com/tech/stl/Generator.html">Generator</a></tt></td>
|
||||
|
||||
<h3>Concept Model</h3>
|
||||
The generator iterator class is a model of
|
||||
<a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>.
|
||||
<td>The generator (0-ary function object) type being wrapped. The
|
||||
return type of the function must be defined as
|
||||
<tt>Generator::result_type</tt>. The function object must be a model of
|
||||
<a href=
|
||||
"http://www.sgi.com/tech/stl/Generator.html">Generator</a>.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>Members</h3>
|
||||
The generator iterator implements the member functions
|
||||
and operators required of the
|
||||
<a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>
|
||||
concept.
|
||||
<h3>Concept Model</h3>
|
||||
|
||||
<br>
|
||||
<p>The generator iterator class is a model of <a href=
|
||||
"http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>.</p>
|
||||
|
||||
<hr>
|
||||
<h2><a name="make_generator_iterator">The Generator Iterator Object Generator</a></h2>
|
||||
<h3>Members</h3>
|
||||
|
||||
The <tt>make_generator_iterator()</tt> function provides a
|
||||
convenient way to create generator iterator objects. The function
|
||||
saves the user the trouble of explicitly writing out the iterator
|
||||
types.
|
||||
<p>The generator iterator implements the member functions and operators
|
||||
required of the <a href=
|
||||
"http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>
|
||||
concept.<br></p>
|
||||
<hr>
|
||||
|
||||
<blockquote>
|
||||
<pre>
|
||||
<h2><a name="make_generator_iterator" id="make_generator_iterator">The
|
||||
Generator Iterator Object Generator</a></h2>
|
||||
|
||||
<p>The <tt>make_generator_iterator()</tt> function provides a convenient
|
||||
way to create generator iterator objects. The function saves the user the
|
||||
trouble of explicitly writing out the iterator types.</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>
|
||||
template <class Generator>
|
||||
typename generator_iterator_generator<Generator>::type
|
||||
make_generator_iterator(Generator & gen);
|
||||
</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<hr>
|
||||
|
||||
<hr>
|
||||
<h3>Example</h3>
|
||||
|
||||
<p>The following program shows how <code>generator_iterator</code>
|
||||
transforms a generator into an input iterator.</p>
|
||||
|
||||
<h3>Example</h3>
|
||||
|
||||
The following program shows how <code>generator_iterator</code>
|
||||
transforms a generator into an input iterator.
|
||||
|
||||
<blockquote>
|
||||
<pre>
|
||||
#include <iostream>
|
||||
#include <boost/generator_iterator.hpp>
|
||||
<blockquote>
|
||||
<pre>
|
||||
#include <iostream>
|
||||
#include <boost/generator_iterator.hpp>
|
||||
|
||||
class my_generator
|
||||
{
|
||||
@ -140,11 +142,22 @@ int main()
|
||||
std::cout << *it << std::endl;
|
||||
}
|
||||
</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<hr>
|
||||
|
||||
<hr>
|
||||
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
||||
"http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional"
|
||||
height="31" width="88"></a></p>
|
||||
|
||||
Written by Jens Maurer.
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->05 December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38516" --></p>
|
||||
|
||||
<p><i>Copyright © 2001 <a href=
|
||||
"../../people/jens_maurer.htm">Jens Maurer</a></i></p>
|
||||
|
||||
<p><i>Distributed under the Boost Software License, Version 1.0. (See
|
||||
accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
|
||||
copy at <a href=
|
||||
"http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user