mirror of
https://github.com/boostorg/iterator.git
synced 2025-06-29 14:01:01 +02:00
Compare commits
1 Commits
boost-1.56
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
a9b594c925 |
0
doc/BidirectionalTraversal.rst
Executable file → Normal file
0
doc/BidirectionalTraversal.rst
Executable file → Normal file
0
doc/ForwardTraversal.rst
Executable file → Normal file
0
doc/ForwardTraversal.rst
Executable file → Normal file
0
doc/GNUmakefile
Executable file → Normal file
0
doc/GNUmakefile
Executable file → Normal file
0
doc/IncrementableIterator.rst
Executable file → Normal file
0
doc/IncrementableIterator.rst
Executable file → Normal file
@ -13,7 +13,6 @@ boostbook standalone
|
|||||||
:
|
:
|
||||||
iterator
|
iterator
|
||||||
:
|
:
|
||||||
<xsl:param>boost.root=../../../..
|
|
||||||
<xsl:param>toc.max.depth=3
|
<xsl:param>toc.max.depth=3
|
||||||
<xsl:param>toc.section.depth=3
|
<xsl:param>toc.section.depth=3
|
||||||
<xsl:param>chunk.section.depth=4
|
<xsl:param>chunk.section.depth=4
|
||||||
|
0
doc/LvalueIterator.rst
Executable file → Normal file
0
doc/LvalueIterator.rst
Executable file → Normal file
0
doc/ReadableIterator.rst
Executable file → Normal file
0
doc/ReadableIterator.rst
Executable file → Normal file
0
doc/SinglePassIterator.rst
Executable file → Normal file
0
doc/SinglePassIterator.rst
Executable file → Normal file
0
doc/SwappableIterator.rst
Executable file → Normal file
0
doc/SwappableIterator.rst
Executable file → Normal file
0
doc/WritableIterator.rst
Executable file → Normal file
0
doc/WritableIterator.rst
Executable file → Normal file
0
doc/counting_iterator.pdf
Executable file → Normal file
0
doc/counting_iterator.pdf
Executable file → Normal file
0
doc/docutils.sty
Executable file → Normal file
0
doc/docutils.sty
Executable file → Normal file
@ -26,7 +26,7 @@
|
|||||||
Lab</a>, <a class="last reference external" href="http://www.styleadvisor.com">Zephyr Associates, Inc.</a></td></tr>
|
Lab</a>, <a class="last reference external" href="http://www.styleadvisor.com">Zephyr Associates, Inc.</a></td></tr>
|
||||||
<tr><th class="docinfo-name">Date:</th>
|
<tr><th class="docinfo-name">Date:</th>
|
||||||
<td>2006-09-11</td></tr>
|
<td>2006-09-11</td></tr>
|
||||||
<tr class="field"><th class="docinfo-name">Number:</th><td class="field-body">This is a revised version of <a class="reference external" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1530.html">N1530</a>=03-0113, which was
|
<tr class="field"><th class="docinfo-name">Number:</th><td class="field-body">This is a revised version of <a class="reference external" href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1530.html">N1530</a>=03-0113, which was
|
||||||
accepted for Technical Report 1 by the C++ standard
|
accepted for Technical Report 1 by the C++ standard
|
||||||
committee's library working group.</td>
|
committee's library working group.</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -239,29 +239,29 @@ Iterator Concepts.</p>
|
|||||||
<div class="section" id="iterator-concepts">
|
<div class="section" id="iterator-concepts">
|
||||||
<h2><a class="toc-backref" href="#id18">Iterator Concepts</a></h2>
|
<h2><a class="toc-backref" href="#id18">Iterator Concepts</a></h2>
|
||||||
<p>This proposal is formulated in terms of the new <tt class="docutils literal"><span class="pre">iterator</span> <span class="pre">concepts</span></tt>
|
<p>This proposal is formulated in terms of the new <tt class="docutils literal"><span class="pre">iterator</span> <span class="pre">concepts</span></tt>
|
||||||
as proposed in <a class="reference external" href="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2003/n1550.htm">n1550</a>, since user-defined and especially adapted
|
as proposed in <a class="reference external" href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/papers/2003/n1550.html">n1550</a>, since user-defined and especially adapted
|
||||||
iterators suffer from the well known categorization problems that are
|
iterators suffer from the well known categorization problems that are
|
||||||
inherent to the current iterator categories.</p>
|
inherent to the current iterator categories.</p>
|
||||||
<p>This proposal does not strictly depend on proposal <a class="reference external" href="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2003/n1550.htm">n1550</a>, as there
|
<p>This proposal does not strictly depend on proposal <a class="reference external" href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/papers/2003/n1550.html">n1550</a>, as there
|
||||||
is a direct mapping between new and old categories. This proposal
|
is a direct mapping between new and old categories. This proposal
|
||||||
could be reformulated using this mapping if <a class="reference external" href="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2003/n1550.htm">n1550</a> was not accepted.</p>
|
could be reformulated using this mapping if <a class="reference external" href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/papers/2003/n1550.html">n1550</a> was not accepted.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="interoperability">
|
<div class="section" id="interoperability">
|
||||||
<h2><a class="toc-backref" href="#id19">Interoperability</a></h2>
|
<h2><a class="toc-backref" href="#id19">Interoperability</a></h2>
|
||||||
<p>The question of iterator interoperability is poorly addressed in the
|
<p>The question of iterator interoperability is poorly addressed in the
|
||||||
current standard. There are currently two defect reports that are
|
current standard. There are currently two defect reports that are
|
||||||
concerned with interoperability issues.</p>
|
concerned with interoperability issues.</p>
|
||||||
<p>Issue <a class="reference external" href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#179">179</a> concerns the fact that mutable container iterator types
|
<p>Issue <a class="reference external" href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#179">179</a> concerns the fact that mutable container iterator types
|
||||||
are only required to be convertible to the corresponding constant
|
are only required to be convertible to the corresponding constant
|
||||||
iterator types, but objects of these types are not required to
|
iterator types, but objects of these types are not required to
|
||||||
interoperate in comparison or subtraction expressions. This situation
|
interoperate in comparison or subtraction expressions. This situation
|
||||||
is tedious in practice and out of line with the way built in types
|
is tedious in practice and out of line with the way built in types
|
||||||
work. This proposal implements the proposed resolution to issue
|
work. This proposal implements the proposed resolution to issue
|
||||||
<a class="reference external" href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#179">179</a>, as most standard library implementations do nowadays. In other
|
<a class="reference external" href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#179">179</a>, as most standard library implementations do nowadays. In other
|
||||||
words, if an iterator type A has an implicit or user defined
|
words, if an iterator type A has an implicit or user defined
|
||||||
conversion to an iterator type B, the iterator types are interoperable
|
conversion to an iterator type B, the iterator types are interoperable
|
||||||
and the usual set of operators are available.</p>
|
and the usual set of operators are available.</p>
|
||||||
<p>Issue <a class="reference external" href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#280">280</a> concerns the current lack of interoperability between
|
<p>Issue <a class="reference external" href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#280">280</a> concerns the current lack of interoperability between
|
||||||
reverse iterator types. The proposed new reverse_iterator template
|
reverse iterator types. The proposed new reverse_iterator template
|
||||||
fixes the issues raised in 280. It provides the desired
|
fixes the issues raised in 280. It provides the desired
|
||||||
interoperability without introducing unwanted overloads.</p>
|
interoperability without introducing unwanted overloads.</p>
|
||||||
@ -422,8 +422,8 @@ member (e.g. <a class="reference internal" href="#counting"><tt class="docutils
|
|||||||
into the temporary iterator <tt class="docutils literal"><span class="pre">p+n</span></tt>, which is destroyed when
|
into the temporary iterator <tt class="docutils literal"><span class="pre">p+n</span></tt>, which is destroyed when
|
||||||
<tt class="docutils literal"><span class="pre">operator[]</span></tt> returns.</p>
|
<tt class="docutils literal"><span class="pre">operator[]</span></tt> returns.</p>
|
||||||
<p>Writable iterators built with <tt class="docutils literal"><span class="pre">iterator_facade</span></tt> implement the
|
<p>Writable iterators built with <tt class="docutils literal"><span class="pre">iterator_facade</span></tt> implement the
|
||||||
semantics required by the preferred resolution to <a class="reference external" href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#299">issue 299</a> and
|
semantics required by the preferred resolution to <a class="reference external" href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#299">issue 299</a> and
|
||||||
adopted by proposal <a class="reference external" href="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2003/n1550.htm">n1550</a>: the result of <tt class="docutils literal"><span class="pre">p[n]</span></tt> is an object
|
adopted by proposal <a class="reference external" href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/papers/2003/n1550.html">n1550</a>: the result of <tt class="docutils literal"><span class="pre">p[n]</span></tt> is an object
|
||||||
convertible to the iterator's <tt class="docutils literal"><span class="pre">value_type</span></tt>, and <tt class="docutils literal"><span class="pre">p[n]</span> <span class="pre">=</span> <span class="pre">x</span></tt> is
|
convertible to the iterator's <tt class="docutils literal"><span class="pre">value_type</span></tt>, and <tt class="docutils literal"><span class="pre">p[n]</span> <span class="pre">=</span> <span class="pre">x</span></tt> is
|
||||||
equivalent to <tt class="docutils literal"><span class="pre">*(p</span> <span class="pre">+</span> <span class="pre">n)</span> <span class="pre">=</span> <span class="pre">x</span></tt> (Note: This result object may be
|
equivalent to <tt class="docutils literal"><span class="pre">*(p</span> <span class="pre">+</span> <span class="pre">n)</span> <span class="pre">=</span> <span class="pre">x</span></tt> (Note: This result object may be
|
||||||
implemented as a proxy containing a copy of <tt class="docutils literal"><span class="pre">p+n</span></tt>). This approach
|
implemented as a proxy containing a copy of <tt class="docutils literal"><span class="pre">p+n</span></tt>). This approach
|
||||||
|
0
doc/facade-and-adaptor.pdf
Executable file → Normal file
0
doc/facade-and-adaptor.pdf
Executable file → Normal file
@ -19,7 +19,7 @@
|
|||||||
.. Version 1.9 of this ReStructuredText document corresponds to
|
.. Version 1.9 of this ReStructuredText document corresponds to
|
||||||
n1530_, the paper accepted by the LWG.
|
n1530_, the paper accepted by the LWG.
|
||||||
|
|
||||||
.. _n1530: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1530.html
|
.. _n1530: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1530.html
|
||||||
|
|
||||||
:copyright: Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003.
|
:copyright: Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003.
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ as proposed in n1550_, since user-defined and especially adapted
|
|||||||
iterators suffer from the well known categorization problems that are
|
iterators suffer from the well known categorization problems that are
|
||||||
inherent to the current iterator categories.
|
inherent to the current iterator categories.
|
||||||
|
|
||||||
.. _n1550: http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2003/n1550.htm
|
.. _n1550: http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/papers/2003/n1550.html
|
||||||
|
|
||||||
This proposal does not strictly depend on proposal n1550_, as there
|
This proposal does not strictly depend on proposal n1550_, as there
|
||||||
is a direct mapping between new and old categories. This proposal
|
is a direct mapping between new and old categories. This proposal
|
||||||
@ -169,8 +169,8 @@ reverse iterator types. The proposed new reverse_iterator template
|
|||||||
fixes the issues raised in 280. It provides the desired
|
fixes the issues raised in 280. It provides the desired
|
||||||
interoperability without introducing unwanted overloads.
|
interoperability without introducing unwanted overloads.
|
||||||
|
|
||||||
.. _179: http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#179
|
.. _179: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#179
|
||||||
.. _280: http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#280
|
.. _280: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#280
|
||||||
|
|
||||||
|
|
||||||
Iterator Facade
|
Iterator Facade
|
||||||
|
0
doc/facade_iterator_category.rst
Executable file → Normal file
0
doc/facade_iterator_category.rst
Executable file → Normal file
0
doc/filter_iterator.pdf
Executable file → Normal file
0
doc/filter_iterator.pdf
Executable file → Normal file
@ -1,13 +1,10 @@
|
|||||||
:Author:
|
:Author:
|
||||||
`Dean Michael Berris <mailto:me@deanberris.com>`_
|
`Dean Michael Berris <mailto:mikhailberis@gmail.com>`_
|
||||||
|
|
||||||
:License:
|
:License:
|
||||||
Distributed under the Boost Software License, Version 1.0
|
Distributed under the Boost Software License, Version 1.0
|
||||||
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
:Copyright:
|
|
||||||
Copyright 2012 Google, Inc.
|
|
||||||
|
|
||||||
Function Input Iterator
|
Function Input Iterator
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
@ -18,14 +15,11 @@ the iterator has been incremented. A Function Input Iterator models the
|
|||||||
|
|
||||||
.. _InputIterator: http://www.sgi.com/tech/stl/InputIterator.html
|
.. _InputIterator: http://www.sgi.com/tech/stl/InputIterator.html
|
||||||
|
|
||||||
The Function Input Iterator takes a function that models the Generator_ concept
|
Like the Generator Iterator, the Function Input Iterator takes a function
|
||||||
(which is basically a nullary or 0-arity function object). The first dereference
|
that models the Generator_ concept (which is basically a nullary or 0-arity
|
||||||
of the iterator at a given position invokes the generator function and stores
|
function object). Each increment of the function Function Input Iterator
|
||||||
and returns the result; subsequent dereferences at the same position simply
|
invokes the generator function and stores the value in the iterator. When
|
||||||
return the same stored result. Incrementing the iterator places it at a new
|
the iterator is dereferenced the stored value is returned.
|
||||||
position, hence a subsequent dereference will generate a new value via another
|
|
||||||
invokation of the generator function. This ensures the generator function is
|
|
||||||
invoked precisely when the iterator is requested to return a (new) value.
|
|
||||||
|
|
||||||
.. _Generator: http://www.sgi.com/tech/stl/Generator.html
|
.. _Generator: http://www.sgi.com/tech/stl/Generator.html
|
||||||
|
|
||||||
@ -64,7 +58,7 @@ Synopsis
|
|||||||
|
|
||||||
template <class Function, class State>
|
template <class Function, class State>
|
||||||
typename function_input_iterator<Function, State>
|
typename function_input_iterator<Function, State>
|
||||||
make_function_input_iterator(Function & f, State s);
|
make_function_input_iterator(Function & f);
|
||||||
|
|
||||||
struct infinite;
|
struct infinite;
|
||||||
}
|
}
|
||||||
@ -118,7 +112,7 @@ it with the ``boost::infinite`` helper class.
|
|||||||
copy(
|
copy(
|
||||||
make_function_input_iterator(f,infinite()),
|
make_function_input_iterator(f,infinite()),
|
||||||
make_function_input_iterator(f,infinite()),
|
make_function_input_iterator(f,infinite()),
|
||||||
ostream_iterator<int>(cout, " ")
|
ostream_iterator<int>(count, " ")
|
||||||
);
|
);
|
||||||
|
|
||||||
Above, instead of creating a huge vector we rely on the STL copy algorithm
|
Above, instead of creating a huge vector we rely on the STL copy algorithm
|
||||||
|
0
doc/function_output_iterator.pdf
Executable file → Normal file
0
doc/function_output_iterator.pdf
Executable file → Normal file
@ -1,163 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<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">
|
|
||||||
|
|
||||||
<h1>Generator Iterator Adaptor</h1>
|
|
||||||
|
|
||||||
<p>Defined in header <a href=
|
|
||||||
"../../boost/generator_iterator.hpp">boost/generator_iterator.hpp</a></p>
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
<h2>Synopsis</h2>
|
|
||||||
|
|
||||||
<blockquote>
|
|
||||||
<pre>
|
|
||||||
namespace boost {
|
|
||||||
template <class Generator>
|
|
||||||
class generator_iterator_policies;
|
|
||||||
|
|
||||||
template <class Generator>
|
|
||||||
class generator_iterator_generator;
|
|
||||||
|
|
||||||
template <class Generator>
|
|
||||||
typename generator_iterator_generator<Generator>::type
|
|
||||||
make_generator_iterator(Generator & gen);
|
|
||||||
}
|
|
||||||
</pre>
|
|
||||||
</blockquote>
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
<h2>The Generator Iterator Generator Class</h2>
|
|
||||||
|
|
||||||
<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:
|
|
||||||
typedef <i>unspecified</i> type; // the resulting generator iterator type
|
|
||||||
}
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<h3>Template Parameters</h3>
|
|
||||||
|
|
||||||
<table border summary="">
|
|
||||||
<tr>
|
|
||||||
<th>Parameter</th>
|
|
||||||
|
|
||||||
<th>Description</th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td><tt><a href=
|
|
||||||
"http://www.sgi.com/tech/stl/Generator.html">Generator</a></tt></td>
|
|
||||||
|
|
||||||
<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>Concept Model</h3>
|
|
||||||
|
|
||||||
<p>The generator iterator class is a model of <a href=
|
|
||||||
"http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>.</p>
|
|
||||||
|
|
||||||
<h3>Members</h3>
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
<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>
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
<h3>Example</h3>
|
|
||||||
|
|
||||||
<p>The following program shows how <code>generator_iterator</code>
|
|
||||||
transforms a generator into an input iterator.</p>
|
|
||||||
|
|
||||||
<blockquote>
|
|
||||||
<pre>
|
|
||||||
#include <iostream>
|
|
||||||
#include <boost/generator_iterator.hpp>
|
|
||||||
|
|
||||||
class my_generator
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef int result_type;
|
|
||||||
my_generator() : state(0) { }
|
|
||||||
int operator()() { return ++state; }
|
|
||||||
private:
|
|
||||||
int state;
|
|
||||||
};
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
my_generator gen;
|
|
||||||
boost::generator_iterator_generator<my_generator>::type it = boost::make_generator_iterator(gen);
|
|
||||||
for(int i = 0; i < 10; ++i, ++it)
|
|
||||||
std::cout << *it << std::endl;
|
|
||||||
}
|
|
||||||
</pre>
|
|
||||||
</blockquote>
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
|
||||||
"../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
|
|
||||||
height="31" width="88"></a></p>
|
|
||||||
|
|
||||||
<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=
|
|
||||||
"http://www.boost.org/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>
|
|
0
doc/indirect_iterator.pdf
Executable file → Normal file
0
doc/indirect_iterator.pdf
Executable file → Normal file
0
doc/indirect_reference_ref.rst
Executable file → Normal file
0
doc/indirect_reference_ref.rst
Executable file → Normal file
0
doc/interoperability-revisited.rst
Executable file → Normal file
0
doc/interoperability-revisited.rst
Executable file → Normal file
@ -3,7 +3,7 @@
|
|||||||
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
.. _N1550: http://www.boost-consulting.com/writing/n1550.html
|
.. _N1550: http://www.boost-consulting.com/writing/n1550.html
|
||||||
.. _N1530: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1530.html
|
.. _N1530: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1530.html
|
||||||
|
|
||||||
:Author: David Abrahams and Jeremy Siek
|
:Author: David Abrahams and Jeremy Siek
|
||||||
:Contact: dave@boost-consulting.com, jsiek@osl.iu.edu
|
:Contact: dave@boost-consulting.com, jsiek@osl.iu.edu
|
||||||
|
0
doc/iterator_adaptor.pdf
Executable file → Normal file
0
doc/iterator_adaptor.pdf
Executable file → Normal file
0
doc/iterator_adaptor_tutorial.rst
Executable file → Normal file
0
doc/iterator_adaptor_tutorial.rst
Executable file → Normal file
0
doc/iterator_archetypes.html
Executable file → Normal file
0
doc/iterator_archetypes.html
Executable file → Normal file
0
doc/iterator_archetypes.pdf
Executable file → Normal file
0
doc/iterator_archetypes.pdf
Executable file → Normal file
0
doc/iterator_archetypes.rst
Executable file → Normal file
0
doc/iterator_archetypes.rst
Executable file → Normal file
0
doc/iterator_concepts.pdf
Executable file → Normal file
0
doc/iterator_concepts.pdf
Executable file → Normal file
0
doc/iterator_concepts.rst
Executable file → Normal file
0
doc/iterator_concepts.rst
Executable file → Normal file
@ -242,8 +242,8 @@ member (e.g. <a class="reference external" href="counting_iterator.html"><tt cla
|
|||||||
into the temporary iterator <tt class="docutils literal"><span class="pre">p+n</span></tt>, which is destroyed when
|
into the temporary iterator <tt class="docutils literal"><span class="pre">p+n</span></tt>, which is destroyed when
|
||||||
<tt class="docutils literal"><span class="pre">operator[]</span></tt> returns.</p>
|
<tt class="docutils literal"><span class="pre">operator[]</span></tt> returns.</p>
|
||||||
<p>Writable iterators built with <tt class="docutils literal"><span class="pre">iterator_facade</span></tt> implement the
|
<p>Writable iterators built with <tt class="docutils literal"><span class="pre">iterator_facade</span></tt> implement the
|
||||||
semantics required by the preferred resolution to <a class="reference external" href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#299">issue 299</a> and
|
semantics required by the preferred resolution to <a class="reference external" href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#299">issue 299</a> and
|
||||||
adopted by proposal <a class="reference external" href="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2003/n1550.htm">n1550</a>: the result of <tt class="docutils literal"><span class="pre">p[n]</span></tt> is an object
|
adopted by proposal <a class="reference external" href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/papers/2003/n1550.html">n1550</a>: the result of <tt class="docutils literal"><span class="pre">p[n]</span></tt> is an object
|
||||||
convertible to the iterator's <tt class="docutils literal"><span class="pre">value_type</span></tt>, and <tt class="docutils literal"><span class="pre">p[n]</span> <span class="pre">=</span> <span class="pre">x</span></tt> is
|
convertible to the iterator's <tt class="docutils literal"><span class="pre">value_type</span></tt>, and <tt class="docutils literal"><span class="pre">p[n]</span> <span class="pre">=</span> <span class="pre">x</span></tt> is
|
||||||
equivalent to <tt class="docutils literal"><span class="pre">*(p</span> <span class="pre">+</span> <span class="pre">n)</span> <span class="pre">=</span> <span class="pre">x</span></tt> (Note: This result object may be
|
equivalent to <tt class="docutils literal"><span class="pre">*(p</span> <span class="pre">+</span> <span class="pre">n)</span> <span class="pre">=</span> <span class="pre">x</span></tt> (Note: This result object may be
|
||||||
implemented as a proxy containing a copy of <tt class="docutils literal"><span class="pre">p+n</span></tt>). This approach
|
implemented as a proxy containing a copy of <tt class="docutils literal"><span class="pre">p+n</span></tt>). This approach
|
||||||
|
0
doc/iterator_facade.pdf
Executable file → Normal file
0
doc/iterator_facade.pdf
Executable file → Normal file
@ -167,9 +167,9 @@ the implementation of her iterator is free to implement an
|
|||||||
class; it will hide the one supplied by ``iterator_facade`` from
|
class; it will hide the one supplied by ``iterator_facade`` from
|
||||||
clients of her iterator.
|
clients of her iterator.
|
||||||
|
|
||||||
.. _n1550: http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2003/n1550.htm
|
.. _n1550: http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/papers/2003/n1550.html
|
||||||
|
|
||||||
.. _`issue 299`: http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#299
|
.. _`issue 299`: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#299
|
||||||
|
|
||||||
.. _`operator arrow`:
|
.. _`operator arrow`:
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ The ``iterator_category`` member of ``iterator_facade`` is
|
|||||||
|
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
*iterator-category*\ (CategoryOrTraversal, reference, value_type)
|
*iterator-category*\ (CategoryOrTraversal, value_type, reference)
|
||||||
|
|
||||||
where *iterator-category* is defined as follows:
|
where *iterator-category* is defined as follows:
|
||||||
|
|
||||||
|
0
doc/iterator_facade_tutorial.rst
Executable file → Normal file
0
doc/iterator_facade_tutorial.rst
Executable file → Normal file
0
doc/iterator_traits.html
Executable file → Normal file
0
doc/iterator_traits.html
Executable file → Normal file
0
doc/iterator_traits.pdf
Executable file → Normal file
0
doc/iterator_traits.pdf
Executable file → Normal file
0
doc/iterator_traits.rst
Executable file → Normal file
0
doc/iterator_traits.rst
Executable file → Normal file
0
doc/make_counting_iterator.rst
Executable file → Normal file
0
doc/make_counting_iterator.rst
Executable file → Normal file
0
doc/make_filter_iterator.rst
Executable file → Normal file
0
doc/make_filter_iterator.rst
Executable file → Normal file
0
doc/make_transform_iterator.rst
Executable file → Normal file
0
doc/make_transform_iterator.rst
Executable file → Normal file
0
doc/make_zip_iterator.rst
Executable file → Normal file
0
doc/make_zip_iterator.rst
Executable file → Normal file
@ -27,10 +27,10 @@
|
|||||||
Lab</a>, <a class="last reference external" href="http://www.styleadvisor.com">Zephyr Associates, Inc.</a></td></tr>
|
Lab</a>, <a class="last reference external" href="http://www.styleadvisor.com">Zephyr Associates, Inc.</a></td></tr>
|
||||||
<tr><th class="docinfo-name">Date:</th>
|
<tr><th class="docinfo-name">Date:</th>
|
||||||
<td>2006-09-11</td></tr>
|
<td>2006-09-11</td></tr>
|
||||||
<tr class="field"><th class="docinfo-name">Number:</th><td class="field-body">This is a revised version of <a class="reference external" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1550.htm">n1550</a>=03-0133, which was
|
<tr class="field"><th class="docinfo-name">Number:</th><td class="field-body">This is a revised version of <a class="reference external" href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1550.html">n1550</a>=03-0133, which was
|
||||||
accepted for Technical Report 1 by the C++ standard
|
accepted for Technical Report 1 by the C++ standard
|
||||||
committee's library working group. This proposal is a
|
committee's library working group. This proposal is a
|
||||||
revision of paper <a class="reference external" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2001/n1297.html">n1297</a>, <a class="reference external" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1477.html">n1477</a>, and <a class="reference external" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1531.html">n1531</a>.</td>
|
revision of paper <a class="reference external" href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2001/n1297.html">n1297</a>, <a class="reference external" href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1477.html">n1477</a>, and <a class="reference external" href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1531.html">n1531</a>.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><th class="docinfo-name">Copyright:</th>
|
<tr><th class="docinfo-name">Copyright:</th>
|
||||||
<td>Copyright David Abrahams, Jeremy Siek, and Thomas Witt
|
<td>Copyright David Abrahams, Jeremy Siek, and Thomas Witt
|
||||||
@ -127,12 +127,12 @@ requirements in the iterator categories.</p>
|
|||||||
<td><tt class="docutils literal"><span class="pre">*i</span></tt> is convertible to <tt class="docutils literal"><span class="pre">T</span></tt></td>
|
<td><tt class="docutils literal"><span class="pre">*i</span></tt> is convertible to <tt class="docutils literal"><span class="pre">T</span></tt></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td>Forward Iterator</td>
|
<tr><td>Forward Iterator</td>
|
||||||
<td><tt class="docutils literal"><span class="pre">*i</span></tt> is <tt class="docutils literal"><span class="pre">T&</span></tt> (or <tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&</span></tt> once <a class="reference external" href="http://www.open-std.org/JTC1/SC22/WG21/docs/lwg-active.html#200">issue 200</a>
|
<td><tt class="docutils literal"><span class="pre">*i</span></tt> is <tt class="docutils literal"><span class="pre">T&</span></tt> (or <tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&</span></tt> once <a class="reference external" href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/lwg-active.html#200">issue 200</a>
|
||||||
is resolved)</td>
|
is resolved)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td>Random Access Iterator</td>
|
<tr><td>Random Access Iterator</td>
|
||||||
<td><tt class="docutils literal"><span class="pre">i[n]</span></tt> is convertible to <tt class="docutils literal"><span class="pre">T</span></tt> (also <tt class="docutils literal"><span class="pre">i[n]</span> <span class="pre">=</span> <span class="pre">t</span></tt>
|
<td><tt class="docutils literal"><span class="pre">i[n]</span></tt> is convertible to <tt class="docutils literal"><span class="pre">T</span></tt> (also <tt class="docutils literal"><span class="pre">i[n]</span> <span class="pre">=</span> <span class="pre">t</span></tt>
|
||||||
is required for mutable iterators once <a class="reference external" href="http://www.open-std.org/JTC1/SC22/WG21/docs/lwg-active.html#299">issue 299</a>
|
is required for mutable iterators once <a class="reference external" href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/lwg-active.html#299">issue 299</a>
|
||||||
is resolved)</td>
|
is resolved)</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -141,7 +141,7 @@ is resolved)</td>
|
|||||||
single hierarchy, many useful iterators can not be appropriately
|
single hierarchy, many useful iterators can not be appropriately
|
||||||
categorized. For example, <tt class="docutils literal"><span class="pre">vector<bool>::iterator</span></tt> is almost a
|
categorized. For example, <tt class="docutils literal"><span class="pre">vector<bool>::iterator</span></tt> is almost a
|
||||||
random access iterator, but the return type is not <tt class="docutils literal"><span class="pre">bool&</span></tt> (see
|
random access iterator, but the return type is not <tt class="docutils literal"><span class="pre">bool&</span></tt> (see
|
||||||
<a class="reference external" href="http://www.open-std.org/JTC1/SC22/WG21/docs/lwg-active.html#96">issue 96</a> and Herb Sutter's paper J16/99-0008 = WG21
|
<a class="reference external" href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/lwg-active.html#96">issue 96</a> and Herb Sutter's paper J16/99-0008 = WG21
|
||||||
N1185). Therefore, the iterators of <tt class="docutils literal"><span class="pre">vector<bool></span></tt> only meet the
|
N1185). Therefore, the iterators of <tt class="docutils literal"><span class="pre">vector<bool></span></tt> only meet the
|
||||||
requirements of input iterator and output iterator. This is so
|
requirements of input iterator and output iterator. This is so
|
||||||
nonintuitive that the C++ standard contradicts itself on this point.
|
nonintuitive that the C++ standard contradicts itself on this point.
|
||||||
@ -344,7 +344,7 @@ approach for specifying <tt class="docutils literal"><span class="pre">operator[
|
|||||||
direction would mean that an iterator satisfying the old Random Access
|
direction would mean that an iterator satisfying the old Random Access
|
||||||
Iterator requirements would not necessarily be a model of Readable or
|
Iterator requirements would not necessarily be a model of Readable or
|
||||||
Writable Lvalue Iterator. Instead we have chosen a design that
|
Writable Lvalue Iterator. Instead we have chosen a design that
|
||||||
matches the preferred resolution of <a class="reference external" href="http://www.open-std.org/JTC1/SC22/WG21/docs/lwg-active.html#299">issue 299</a>: <tt class="docutils literal"><span class="pre">operator[]</span></tt> is
|
matches the preferred resolution of <a class="reference external" href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/lwg-active.html#299">issue 299</a>: <tt class="docutils literal"><span class="pre">operator[]</span></tt> is
|
||||||
only required to return something convertible to the <tt class="docutils literal"><span class="pre">value_type</span></tt>
|
only required to return something convertible to the <tt class="docutils literal"><span class="pre">value_type</span></tt>
|
||||||
(for a Readable Iterator), and is required to support assignment
|
(for a Readable Iterator), and is required to support assignment
|
||||||
<tt class="docutils literal"><span class="pre">i[n]</span> <span class="pre">=</span> <span class="pre">t</span></tt> (for a Writable Iterator).</p>
|
<tt class="docutils literal"><span class="pre">i[n]</span> <span class="pre">=</span> <span class="pre">t</span></tt> (for a Writable Iterator).</p>
|
||||||
@ -976,7 +976,7 @@ struct random_access_traversal_tag : bidirectional_traversal_tag { };
|
|||||||
<div class="section" id="addition-to-lib-iterator-traits">
|
<div class="section" id="addition-to-lib-iterator-traits">
|
||||||
<h2><a class="toc-backref" href="#id23">Addition to [lib.iterator.traits]</a></h2>
|
<h2><a class="toc-backref" href="#id23">Addition to [lib.iterator.traits]</a></h2>
|
||||||
<p>The <tt class="docutils literal"><span class="pre">is_readable_iterator</span></tt> class
|
<p>The <tt class="docutils literal"><span class="pre">is_readable_iterator</span></tt> class
|
||||||
template satisfies the <a class="reference external" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1519.htm">UnaryTypeTrait</a> requirements.</p>
|
template satisfies the <a class="reference external" href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1519.htm">UnaryTypeTrait</a> requirements.</p>
|
||||||
<p>Given an iterator type <tt class="docutils literal"><span class="pre">X</span></tt>, <tt class="docutils literal"><span class="pre">is_readable_iterator<X>::value</span></tt>
|
<p>Given an iterator type <tt class="docutils literal"><span class="pre">X</span></tt>, <tt class="docutils literal"><span class="pre">is_readable_iterator<X>::value</span></tt>
|
||||||
yields <tt class="docutils literal"><span class="pre">true</span></tt> if, for an object <tt class="docutils literal"><span class="pre">a</span></tt> of type <tt class="docutils literal"><span class="pre">X</span></tt>, <tt class="docutils literal"><span class="pre">*a</span></tt> is
|
yields <tt class="docutils literal"><span class="pre">true</span></tt> if, for an object <tt class="docutils literal"><span class="pre">a</span></tt> of type <tt class="docutils literal"><span class="pre">X</span></tt>, <tt class="docutils literal"><span class="pre">*a</span></tt> is
|
||||||
convertible to <tt class="docutils literal"><span class="pre">iterator_traits<X>::value_type</span></tt>, and <tt class="docutils literal"><span class="pre">false</span></tt>
|
convertible to <tt class="docutils literal"><span class="pre">iterator_traits<X>::value_type</span></tt>, and <tt class="docutils literal"><span class="pre">false</span></tt>
|
||||||
@ -1007,7 +1007,7 @@ otherwise.</p>
|
|||||||
</div>
|
</div>
|
||||||
<div class="section" id="footnotes">
|
<div class="section" id="footnotes">
|
||||||
<h1><a class="toc-backref" href="#id24">Footnotes</a></h1>
|
<h1><a class="toc-backref" href="#id24">Footnotes</a></h1>
|
||||||
<p>The UnaryTypeTrait concept is defined in <a class="reference external" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1519.htm">n1519</a>; the LWG is
|
<p>The UnaryTypeTrait concept is defined in <a class="reference external" href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1519.htm">n1519</a>; the LWG is
|
||||||
considering adding the requirement that specializations are derived
|
considering adding the requirement that specializations are derived
|
||||||
from their nested <tt class="docutils literal"><span class="pre">::type</span></tt>.</p>
|
from their nested <tt class="docutils literal"><span class="pre">::type</span></tt>.</p>
|
||||||
<!-- LocalWords: Abrahams Siek Witt const bool Sutter's WG int UL LI href Lvalue
|
<!-- LocalWords: Abrahams Siek Witt const bool Sutter's WG int UL LI href Lvalue
|
||||||
|
0
doc/new-iter-concepts.pdf
Executable file → Normal file
0
doc/new-iter-concepts.pdf
Executable file → Normal file
@ -38,10 +38,10 @@
|
|||||||
|
|
||||||
.. contents:: Table of Contents
|
.. contents:: Table of Contents
|
||||||
|
|
||||||
.. _n1297: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2001/n1297.html
|
.. _n1297: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2001/n1297.html
|
||||||
.. _n1477: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1477.html
|
.. _n1477: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1477.html
|
||||||
.. _n1531: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1531.html
|
.. _n1531: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1531.html
|
||||||
.. _n1550: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1550.htm
|
.. _n1550: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1550.html
|
||||||
|
|
||||||
============
|
============
|
||||||
Motivation
|
Motivation
|
||||||
@ -76,8 +76,8 @@ requirements in the iterator categories.
|
|||||||
| |is resolved) |
|
| |is resolved) |
|
||||||
+------------------------+-----------------------------------------------------+
|
+------------------------+-----------------------------------------------------+
|
||||||
|
|
||||||
.. _issue 200: http://www.open-std.org/JTC1/SC22/WG21/docs/lwg-active.html#200
|
.. _issue 200: http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/lwg-active.html#200
|
||||||
.. _issue 299: http://www.open-std.org/JTC1/SC22/WG21/docs/lwg-active.html#299
|
.. _issue 299: http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/lwg-active.html#299
|
||||||
|
|
||||||
|
|
||||||
Because iterator traversal and value access are mixed together in a
|
Because iterator traversal and value access are mixed together in a
|
||||||
@ -91,7 +91,7 @@ nonintuitive that the C++ standard contradicts itself on this point.
|
|||||||
In paragraph 23.2.4/1 it says that a ``vector`` is a sequence that
|
In paragraph 23.2.4/1 it says that a ``vector`` is a sequence that
|
||||||
supports random access iterators.
|
supports random access iterators.
|
||||||
|
|
||||||
.. _issue 96: http://www.open-std.org/JTC1/SC22/WG21/docs/lwg-active.html#96
|
.. _issue 96: http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/lwg-active.html#96
|
||||||
|
|
||||||
Another difficult-to-categorize iterator is the transform iterator, an
|
Another difficult-to-categorize iterator is the transform iterator, an
|
||||||
adaptor which applies a unary function object to the dereferenced
|
adaptor which applies a unary function object to the dereferenced
|
||||||
@ -791,7 +791,7 @@ The UnaryTypeTrait concept is defined in n1519_; the LWG is
|
|||||||
considering adding the requirement that specializations are derived
|
considering adding the requirement that specializations are derived
|
||||||
from their nested ``::type``.
|
from their nested ``::type``.
|
||||||
|
|
||||||
.. _n1519: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1519.htm
|
.. _n1519: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1519.htm
|
||||||
|
|
||||||
..
|
..
|
||||||
LocalWords: Abrahams Siek Witt const bool Sutter's WG int UL LI href Lvalue
|
LocalWords: Abrahams Siek Witt const bool Sutter's WG int UL LI href Lvalue
|
||||||
|
0
doc/permutation_iterator.pdf
Executable file → Normal file
0
doc/permutation_iterator.pdf
Executable file → Normal file
0
doc/pointee.html
Executable file → Normal file
0
doc/pointee.html
Executable file → Normal file
0
doc/pointee.pdf
Executable file → Normal file
0
doc/pointee.pdf
Executable file → Normal file
0
doc/pointee.rst
Executable file → Normal file
0
doc/pointee.rst
Executable file → Normal file
0
doc/pointee_ref.rst
Executable file → Normal file
0
doc/pointee_ref.rst
Executable file → Normal file
@ -165,9 +165,9 @@ the implementation of her iterator is free to implement an
|
|||||||
class; it will hide the one supplied by `iterator_facade` from
|
class; it will hide the one supplied by `iterator_facade` from
|
||||||
clients of her iterator.
|
clients of her iterator.
|
||||||
|
|
||||||
.. _n1550: http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2003/n1550.htm
|
.. _n1550: http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/papers/2003/n1550.html
|
||||||
|
|
||||||
.. _`issue 299`: http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#299
|
.. _`issue 299`: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#299
|
||||||
|
|
||||||
.. _`operator arrow`:
|
.. _`operator arrow`:
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
.. _N1550: http://www.boost-consulting.com/writing/n1550.html
|
.. _N1550: http://www.boost-consulting.com/writing/n1550.html
|
||||||
.. _N1530: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1530.html
|
.. _N1530: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1530.html
|
||||||
|
|
||||||
:Author: David Abrahams and Jeremy Siek
|
:Author: David Abrahams and Jeremy Siek
|
||||||
:Contact: dave@boost-consulting.com, jsiek@osl.iu.edu
|
:Contact: dave@boost-consulting.com, jsiek@osl.iu.edu
|
||||||
|
0
doc/reverse_iterator.pdf
Executable file → Normal file
0
doc/reverse_iterator.pdf
Executable file → Normal file
@ -99,7 +99,7 @@ private:
|
|||||||
</pre>
|
</pre>
|
||||||
<p>If <tt class="docutils literal"><span class="pre">Reference</span></tt> is <tt class="docutils literal"><span class="pre">use_default</span></tt> then the <tt class="docutils literal"><span class="pre">reference</span></tt> member of
|
<p>If <tt class="docutils literal"><span class="pre">Reference</span></tt> is <tt class="docutils literal"><span class="pre">use_default</span></tt> then the <tt class="docutils literal"><span class="pre">reference</span></tt> member of
|
||||||
<tt class="docutils literal"><span class="pre">transform_iterator</span></tt> is
|
<tt class="docutils literal"><span class="pre">transform_iterator</span></tt> is
|
||||||
<tt class="docutils literal"><span class="pre">result_of<const UnaryFunction(iterator_traits<Iterator>::reference)>::type</span></tt>.
|
<tt class="docutils literal"><span class="pre">result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type</span></tt>.
|
||||||
Otherwise, <tt class="docutils literal"><span class="pre">reference</span></tt> is <tt class="docutils literal"><span class="pre">Reference</span></tt>.</p>
|
Otherwise, <tt class="docutils literal"><span class="pre">reference</span></tt> is <tt class="docutils literal"><span class="pre">Reference</span></tt>.</p>
|
||||||
<p>If <tt class="docutils literal"><span class="pre">Value</span></tt> is <tt class="docutils literal"><span class="pre">use_default</span></tt> then the <tt class="docutils literal"><span class="pre">value_type</span></tt> member is
|
<p>If <tt class="docutils literal"><span class="pre">Value</span></tt> is <tt class="docutils literal"><span class="pre">use_default</span></tt> then the <tt class="docutils literal"><span class="pre">value_type</span></tt> member is
|
||||||
<tt class="docutils literal"><span class="pre">remove_cv<remove_reference<reference></span> <span class="pre">>::type</span></tt>. Otherwise,
|
<tt class="docutils literal"><span class="pre">remove_cv<remove_reference<reference></span> <span class="pre">>::type</span></tt>. Otherwise,
|
||||||
@ -117,10 +117,10 @@ convertible to <tt class="docutils literal"><span class="pre">input_iterator_tag
|
|||||||
<div class="section" id="transform-iterator-requirements">
|
<div class="section" id="transform-iterator-requirements">
|
||||||
<h1><a class="toc-backref" href="#id3"><tt class="docutils literal"><span class="pre">transform_iterator</span></tt> requirements</a></h1>
|
<h1><a class="toc-backref" href="#id3"><tt class="docutils literal"><span class="pre">transform_iterator</span></tt> requirements</a></h1>
|
||||||
<p>The type <tt class="docutils literal"><span class="pre">UnaryFunction</span></tt> must be Assignable, Copy Constructible, and
|
<p>The type <tt class="docutils literal"><span class="pre">UnaryFunction</span></tt> must be Assignable, Copy Constructible, and
|
||||||
the expression <tt class="docutils literal"><span class="pre">f(*i)</span></tt> must be valid where <tt class="docutils literal"><span class="pre">f</span></tt> is a const object of
|
the expression <tt class="docutils literal"><span class="pre">f(*i)</span></tt> must be valid where <tt class="docutils literal"><span class="pre">f</span></tt> is an object of
|
||||||
type <tt class="docutils literal"><span class="pre">UnaryFunction</span></tt>, <tt class="docutils literal"><span class="pre">i</span></tt> is an object of type <tt class="docutils literal"><span class="pre">Iterator</span></tt>, and
|
type <tt class="docutils literal"><span class="pre">UnaryFunction</span></tt>, <tt class="docutils literal"><span class="pre">i</span></tt> is an object of type <tt class="docutils literal"><span class="pre">Iterator</span></tt>, and
|
||||||
where the type of <tt class="docutils literal"><span class="pre">f(*i)</span></tt> must be
|
where the type of <tt class="docutils literal"><span class="pre">f(*i)</span></tt> must be
|
||||||
<tt class="docutils literal"><span class="pre">result_of<const UnaryFunction(iterator_traits<Iterator>::reference)>::type</span></tt>.</p>
|
<tt class="docutils literal"><span class="pre">result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type</span></tt>.</p>
|
||||||
<p>The argument <tt class="docutils literal"><span class="pre">Iterator</span></tt> shall model Readable Iterator.</p>
|
<p>The argument <tt class="docutils literal"><span class="pre">Iterator</span></tt> shall model Readable Iterator.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="transform-iterator-models">
|
<div class="section" id="transform-iterator-models">
|
||||||
|
0
doc/transform_iterator.pdf
Executable file → Normal file
0
doc/transform_iterator.pdf
Executable file → Normal file
0
doc/transform_iterator_eg.rst
Executable file → Normal file
0
doc/transform_iterator_eg.rst
Executable file → Normal file
@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
If ``Reference`` is ``use_default`` then the ``reference`` member of
|
If ``Reference`` is ``use_default`` then the ``reference`` member of
|
||||||
``transform_iterator`` is
|
``transform_iterator`` is
|
||||||
``result_of<const UnaryFunction(iterator_traits<Iterator>::reference)>::type``.
|
``result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type``.
|
||||||
Otherwise, ``reference`` is ``Reference``.
|
Otherwise, ``reference`` is ``Reference``.
|
||||||
|
|
||||||
If ``Value`` is ``use_default`` then the ``value_type`` member is
|
If ``Value`` is ``use_default`` then the ``value_type`` member is
|
||||||
@ -64,10 +64,10 @@ convertible to ``input_iterator_tag``.
|
|||||||
...................................
|
...................................
|
||||||
|
|
||||||
The type ``UnaryFunction`` must be Assignable, Copy Constructible, and
|
The type ``UnaryFunction`` must be Assignable, Copy Constructible, and
|
||||||
the expression ``f(*i)`` must be valid where ``f`` is a const object of
|
the expression ``f(*i)`` must be valid where ``f`` is an object of
|
||||||
type ``UnaryFunction``, ``i`` is an object of type ``Iterator``, and
|
type ``UnaryFunction``, ``i`` is an object of type ``Iterator``, and
|
||||||
where the type of ``f(*i)`` must be
|
where the type of ``f(*i)`` must be
|
||||||
``result_of<const UnaryFunction(iterator_traits<Iterator>::reference)>::type``.
|
``result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type``.
|
||||||
|
|
||||||
The argument ``Iterator`` shall model Readable Iterator.
|
The argument ``Iterator`` shall model Readable Iterator.
|
||||||
|
|
||||||
|
0
doc/zip_iterator.html
Executable file → Normal file
0
doc/zip_iterator.html
Executable file → Normal file
0
doc/zip_iterator.pdf
Executable file → Normal file
0
doc/zip_iterator.pdf
Executable file → Normal file
0
doc/zip_iterator.rst
Executable file → Normal file
0
doc/zip_iterator.rst
Executable file → Normal file
0
doc/zip_iterator_abstract.rst
Executable file → Normal file
0
doc/zip_iterator_abstract.rst
Executable file → Normal file
0
doc/zip_iterator_eg.rst
Executable file → Normal file
0
doc/zip_iterator_eg.rst
Executable file → Normal file
0
doc/zip_iterator_ref.rst
Executable file → Normal file
0
doc/zip_iterator_ref.rst
Executable file → Normal file
0
example/node.hpp
Executable file → Normal file
0
example/node.hpp
Executable file → Normal file
0
example/node_iterator1.cpp
Executable file → Normal file
0
example/node_iterator1.cpp
Executable file → Normal file
0
example/node_iterator1.hpp
Executable file → Normal file
0
example/node_iterator1.hpp
Executable file → Normal file
0
example/node_iterator2.cpp
Executable file → Normal file
0
example/node_iterator2.cpp
Executable file → Normal file
0
example/node_iterator2.hpp
Executable file → Normal file
0
example/node_iterator2.hpp
Executable file → Normal file
0
example/node_iterator3.cpp
Executable file → Normal file
0
example/node_iterator3.cpp
Executable file → Normal file
0
example/node_iterator3.hpp
Executable file → Normal file
0
example/node_iterator3.hpp
Executable file → Normal file
@ -1,80 +0,0 @@
|
|||||||
// (C) Copyright Jens Maurer 2001.
|
|
||||||
// Distributed under the Boost Software License, Version 1.0. (See
|
|
||||||
// accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
//
|
|
||||||
// Revision History:
|
|
||||||
|
|
||||||
// 15 Nov 2001 Jens Maurer
|
|
||||||
// created.
|
|
||||||
|
|
||||||
// See http://www.boost.org/libs/utility/iterator_adaptors.htm for documentation.
|
|
||||||
|
|
||||||
#ifndef BOOST_ITERATOR_ADAPTOR_GENERATOR_ITERATOR_HPP
|
|
||||||
#define BOOST_ITERATOR_ADAPTOR_GENERATOR_ITERATOR_HPP
|
|
||||||
|
|
||||||
#include <boost/iterator/iterator_facade.hpp>
|
|
||||||
#include <boost/ref.hpp>
|
|
||||||
|
|
||||||
namespace boost {
|
|
||||||
|
|
||||||
template<class Generator>
|
|
||||||
class generator_iterator
|
|
||||||
: public iterator_facade<
|
|
||||||
generator_iterator<Generator>
|
|
||||||
, typename Generator::result_type
|
|
||||||
, single_pass_traversal_tag
|
|
||||||
, typename Generator::result_type const&
|
|
||||||
>
|
|
||||||
{
|
|
||||||
typedef iterator_facade<
|
|
||||||
generator_iterator<Generator>
|
|
||||||
, typename Generator::result_type
|
|
||||||
, single_pass_traversal_tag
|
|
||||||
, typename Generator::result_type const&
|
|
||||||
> super_t;
|
|
||||||
|
|
||||||
public:
|
|
||||||
generator_iterator() {}
|
|
||||||
generator_iterator(Generator* g) : m_g(g), m_value((*m_g)()) {}
|
|
||||||
|
|
||||||
void increment()
|
|
||||||
{
|
|
||||||
m_value = (*m_g)();
|
|
||||||
}
|
|
||||||
|
|
||||||
const typename Generator::result_type&
|
|
||||||
dereference() const
|
|
||||||
{
|
|
||||||
return m_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool equal(generator_iterator const& y) const
|
|
||||||
{
|
|
||||||
return this->m_g == y.m_g && this->m_value == y.m_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
Generator* m_g;
|
|
||||||
typename Generator::result_type m_value;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class Generator>
|
|
||||||
struct generator_iterator_generator
|
|
||||||
{
|
|
||||||
typedef generator_iterator<Generator> type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class Generator>
|
|
||||||
inline generator_iterator<Generator>
|
|
||||||
make_generator_iterator(Generator & gen)
|
|
||||||
{
|
|
||||||
typedef generator_iterator<Generator> result_t;
|
|
||||||
return result_t(&gen);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace boost
|
|
||||||
|
|
||||||
|
|
||||||
#endif // BOOST_ITERATOR_ADAPTOR_GENERATOR_ITERATOR_HPP
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
|||||||
#ifndef INDIRECT_REFERENCE_DWA200415_HPP
|
|
||||||
# define INDIRECT_REFERENCE_DWA200415_HPP
|
|
||||||
|
|
||||||
//
|
|
||||||
// Copyright David Abrahams 2004. Use, modification and distribution is
|
|
||||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
|
||||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
//
|
|
||||||
// typename indirect_reference<P>::type provides the type of *p.
|
|
||||||
//
|
|
||||||
// http://www.boost.org/libs/iterator/doc/pointee.html
|
|
||||||
//
|
|
||||||
|
|
||||||
# include <boost/detail/is_incrementable.hpp>
|
|
||||||
# include <boost/iterator/iterator_traits.hpp>
|
|
||||||
# include <boost/type_traits/remove_cv.hpp>
|
|
||||||
# include <boost/mpl/eval_if.hpp>
|
|
||||||
# include <boost/pointee.hpp>
|
|
||||||
|
|
||||||
namespace boost {
|
|
||||||
|
|
||||||
namespace detail
|
|
||||||
{
|
|
||||||
template <class P>
|
|
||||||
struct smart_ptr_reference
|
|
||||||
{
|
|
||||||
typedef typename boost::pointee<P>::type& type;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class P>
|
|
||||||
struct indirect_reference
|
|
||||||
: mpl::eval_if<
|
|
||||||
detail::is_incrementable<P>
|
|
||||||
, iterator_reference<P>
|
|
||||||
, detail::smart_ptr_reference<P>
|
|
||||||
>
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace boost
|
|
||||||
|
|
||||||
#endif // INDIRECT_REFERENCE_DWA200415_HPP
|
|
59
include/boost/iterator.hpp
Normal file
59
include/boost/iterator.hpp
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
// iterator.hpp workarounds for non-conforming standard libraries ---------//
|
||||||
|
|
||||||
|
// (C) Copyright Beman Dawes 2000. Distributed under the Boost
|
||||||
|
// Software License, Version 1.0. (See accompanying file
|
||||||
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
// See http://www.boost.org/libs/utility for documentation.
|
||||||
|
|
||||||
|
// Revision History
|
||||||
|
// 12 Jan 01 added <cstddef> for std::ptrdiff_t (Jens Maurer)
|
||||||
|
// 28 Jun 00 Workarounds to deal with known MSVC bugs (David Abrahams)
|
||||||
|
// 26 Jun 00 Initial version (Jeremy Siek)
|
||||||
|
|
||||||
|
#ifndef BOOST_ITERATOR_HPP
|
||||||
|
#define BOOST_ITERATOR_HPP
|
||||||
|
|
||||||
|
#include <iterator>
|
||||||
|
#include <cstddef> // std::ptrdiff_t
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
# if defined(BOOST_NO_STD_ITERATOR) && !defined(BOOST_MSVC_STD_ITERATOR)
|
||||||
|
template <class Category, class T,
|
||||||
|
class Distance = std::ptrdiff_t,
|
||||||
|
class Pointer = T*, class Reference = T&>
|
||||||
|
struct iterator
|
||||||
|
{
|
||||||
|
typedef T value_type;
|
||||||
|
typedef Distance difference_type;
|
||||||
|
typedef Pointer pointer;
|
||||||
|
typedef Reference reference;
|
||||||
|
typedef Category iterator_category;
|
||||||
|
};
|
||||||
|
# else
|
||||||
|
|
||||||
|
// declare iterator_base in namespace detail to work around MSVC bugs which
|
||||||
|
// prevent derivation from an identically-named class in a different namespace.
|
||||||
|
namespace detail {
|
||||||
|
template <class Category, class T, class Distance, class Pointer, class Reference>
|
||||||
|
# if !defined(BOOST_MSVC_STD_ITERATOR)
|
||||||
|
struct iterator_base : std::iterator<Category, T, Distance, Pointer, Reference> {};
|
||||||
|
# else
|
||||||
|
struct iterator_base : std::iterator<Category, T, Distance>
|
||||||
|
{
|
||||||
|
typedef Reference reference;
|
||||||
|
typedef Pointer pointer;
|
||||||
|
typedef Distance difference_type;
|
||||||
|
};
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Category, class T, class Distance = std::ptrdiff_t,
|
||||||
|
class Pointer = T*, class Reference = T&>
|
||||||
|
struct iterator : boost::detail::iterator_base<Category, T, Distance, Pointer, Reference> {};
|
||||||
|
# endif
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif // BOOST_ITERATOR_HPP
|
0
include/boost/iterator/detail/any_conversion_eater.hpp
Executable file → Normal file
0
include/boost/iterator/detail/any_conversion_eater.hpp
Executable file → Normal file
@ -73,10 +73,16 @@ struct iterator_writability_disabled
|
|||||||
// Convert an iterator_facade's traversal category, Value parameter,
|
// Convert an iterator_facade's traversal category, Value parameter,
|
||||||
// and ::reference type to an appropriate old-style category.
|
// and ::reference type to an appropriate old-style category.
|
||||||
//
|
//
|
||||||
// Due to changeset 21683, this now never results in a category convertible
|
// If writability has been disabled per the above metafunction, the
|
||||||
// to output_iterator_tag.
|
// result will not be convertible to output_iterator_tag.
|
||||||
|
//
|
||||||
|
// Otherwise, if Traversal == single_pass_traversal_tag, the following
|
||||||
|
// conditions will result in a tag that is convertible both to
|
||||||
|
// input_iterator_tag and output_iterator_tag:
|
||||||
|
//
|
||||||
|
// 1. Reference is a reference to non-const
|
||||||
|
// 2. Reference is not a reference and is convertible to Value
|
||||||
//
|
//
|
||||||
// Change at: https://svn.boost.org/trac/boost/changeset/21683
|
|
||||||
template <class Traversal, class ValueParam, class Reference>
|
template <class Traversal, class ValueParam, class Reference>
|
||||||
struct iterator_facade_default_category
|
struct iterator_facade_default_category
|
||||||
: mpl::eval_if<
|
: mpl::eval_if<
|
||||||
|
0
include/boost/iterator/detail/minimum_category.hpp
Executable file → Normal file
0
include/boost/iterator/detail/minimum_category.hpp
Executable file → Normal file
@ -1,88 +0,0 @@
|
|||||||
// (C) Copyright David Abrahams 2002.
|
|
||||||
// (C) Copyright Jeremy Siek 2002.
|
|
||||||
// (C) Copyright Thomas Witt 2002.
|
|
||||||
// (C) Copyright Jeffrey Lee Hellrung, Jr. 2012.
|
|
||||||
// Distributed under the Boost Software License, Version 1.0. (See
|
|
||||||
// accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
#ifndef BOOST_OPERATOR_BRACKETS_DISPATCH_07102012JLH_HPP
|
|
||||||
#define BOOST_OPERATOR_BRACKETS_DISPATCH_07102012JLH_HPP
|
|
||||||
|
|
||||||
#include <boost/iterator/detail/facade_iterator_category.hpp>
|
|
||||||
|
|
||||||
#include <boost/type_traits/is_pod.hpp>
|
|
||||||
#include <boost/type_traits/remove_const.hpp>
|
|
||||||
|
|
||||||
#include <boost/mpl/if.hpp>
|
|
||||||
|
|
||||||
namespace boost { namespace detail {
|
|
||||||
|
|
||||||
// operator[] must return a proxy in case iterator destruction invalidates
|
|
||||||
// referents.
|
|
||||||
// To see why, consider the following implementation of operator[]:
|
|
||||||
// reference operator[](difference_type n) const
|
|
||||||
// { return *(*this + n); }
|
|
||||||
// The problem here is that operator[] would return a reference created from
|
|
||||||
// a temporary iterator.
|
|
||||||
|
|
||||||
template <class Value>
|
|
||||||
struct operator_brackets_value
|
|
||||||
{
|
|
||||||
typedef Value result_type;
|
|
||||||
template <class Iterator>
|
|
||||||
static result_type apply(Iterator const & i)
|
|
||||||
{ return *i; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class Iterator, class Reference>
|
|
||||||
struct operator_brackets_const_proxy
|
|
||||||
{
|
|
||||||
class result_type
|
|
||||||
{
|
|
||||||
Iterator const m_i;
|
|
||||||
explicit result_type(Iterator const & i) : m_i(i) { }
|
|
||||||
friend struct operator_brackets_const_proxy;
|
|
||||||
void operator=(result_type&);
|
|
||||||
public:
|
|
||||||
operator Reference() const { return *m_i; }
|
|
||||||
};
|
|
||||||
static result_type apply(Iterator const & i)
|
|
||||||
{ return result_type(i); }
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class Iterator, class Reference>
|
|
||||||
struct operator_brackets_proxy
|
|
||||||
{
|
|
||||||
class result_type
|
|
||||||
{
|
|
||||||
Iterator const m_i;
|
|
||||||
explicit result_type(Iterator const & i) : m_i(i) { }
|
|
||||||
friend struct operator_brackets_proxy;
|
|
||||||
void operator=(result_type&);
|
|
||||||
public:
|
|
||||||
operator Reference() const { return *m_i; }
|
|
||||||
operator_brackets_proxy const & operator=(
|
|
||||||
typename Iterator::value_type const & x) const
|
|
||||||
{ *m_i = x; return *this; }
|
|
||||||
};
|
|
||||||
static result_type apply(Iterator const & i)
|
|
||||||
{ return result_type(i); }
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class Iterator, class ValueType, class Reference>
|
|
||||||
struct operator_brackets_dispatch
|
|
||||||
{
|
|
||||||
typedef typename mpl::if_c<
|
|
||||||
iterator_writability_disabled<ValueType,Reference>::value,
|
|
||||||
typename mpl::if_c<
|
|
||||||
boost::is_POD<ValueType>::value,
|
|
||||||
operator_brackets_value<typename boost::remove_const<ValueType>::type>,
|
|
||||||
operator_brackets_const_proxy<Iterator,Reference>
|
|
||||||
>::type,
|
|
||||||
operator_brackets_proxy<Iterator,Reference>
|
|
||||||
>::type type;
|
|
||||||
};
|
|
||||||
|
|
||||||
} } // namespace detail / namespace boost
|
|
||||||
|
|
||||||
#endif // #ifndef BOOST_OPERATOR_BRACKETS_DISPATCH_07102012JLH_HPP
|
|
@ -1,6 +1,4 @@
|
|||||||
// Copyright 2009 (C) Dean Michael Berris <me@deanberris.com>
|
// Copyright 2009 (C) Dean Michael Berris <me@deanberris.com>
|
||||||
// Copyright 2012 (C) Google, Inc.
|
|
||||||
// Copyright 2012 (C) Jeffrey Lee Hellrung, Jr.
|
|
||||||
// Distributed under the Boost Software License, Version 1.0. (See
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// accompanying file LICENSE_1_0.txt or copy at
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
@ -9,19 +7,10 @@
|
|||||||
#ifndef BOOST_FUNCTION_INPUT_ITERATOR
|
#ifndef BOOST_FUNCTION_INPUT_ITERATOR
|
||||||
#define BOOST_FUNCTION_INPUT_ITERATOR
|
#define BOOST_FUNCTION_INPUT_ITERATOR
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
|
||||||
#include <boost/mpl/if.hpp>
|
|
||||||
#include <boost/function_types/is_function_pointer.hpp>
|
|
||||||
#include <boost/function_types/is_function_reference.hpp>
|
|
||||||
#include <boost/function_types/result_type.hpp>
|
|
||||||
#include <boost/iterator/iterator_facade.hpp>
|
#include <boost/iterator/iterator_facade.hpp>
|
||||||
#include <boost/none.hpp>
|
|
||||||
#include <boost/optional/optional.hpp>
|
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
|
|
||||||
namespace impl {
|
|
||||||
|
|
||||||
template <class Function, class Input>
|
template <class Function, class Input>
|
||||||
class function_input_iterator
|
class function_input_iterator
|
||||||
: public iterator_facade<
|
: public iterator_facade<
|
||||||
@ -33,20 +22,17 @@ namespace boost {
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
function_input_iterator() {}
|
function_input_iterator() {}
|
||||||
function_input_iterator(Function & f_, Input state_ = Input())
|
function_input_iterator(Function * f_, Input state_ = Input())
|
||||||
: f(&f_), state(state_) {}
|
: f(f_), state(state_), value((*f)()) {}
|
||||||
|
|
||||||
void increment() {
|
void increment() {
|
||||||
if(value)
|
value = (*f)();
|
||||||
value = none;
|
|
||||||
else
|
|
||||||
(*f)();
|
|
||||||
++state;
|
++state;
|
||||||
}
|
}
|
||||||
|
|
||||||
typename Function::result_type const &
|
typename Function::result_type const &
|
||||||
dereference() const {
|
dereference() const {
|
||||||
return (value ? value : value = (*f)()).get();
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool equal(function_input_iterator const & other) const {
|
bool equal(function_input_iterator const & other) const {
|
||||||
@ -56,96 +42,14 @@ namespace boost {
|
|||||||
private:
|
private:
|
||||||
Function * f;
|
Function * f;
|
||||||
Input state;
|
Input state;
|
||||||
mutable optional<typename Function::result_type> value;
|
typename Function::result_type value;
|
||||||
};
|
|
||||||
|
|
||||||
template <class Function, class Input>
|
|
||||||
class function_pointer_input_iterator
|
|
||||||
: public iterator_facade<
|
|
||||||
function_pointer_input_iterator<Function, Input>,
|
|
||||||
typename function_types::result_type<Function>::type,
|
|
||||||
single_pass_traversal_tag,
|
|
||||||
typename function_types::result_type<Function>::type const &
|
|
||||||
>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
function_pointer_input_iterator() {}
|
|
||||||
function_pointer_input_iterator(Function &f_, Input state_ = Input())
|
|
||||||
: f(f_), state(state_) {}
|
|
||||||
|
|
||||||
void increment() {
|
|
||||||
if(value)
|
|
||||||
value = none;
|
|
||||||
else
|
|
||||||
(*f)();
|
|
||||||
++state;
|
|
||||||
}
|
|
||||||
|
|
||||||
typename function_types::result_type<Function>::type const &
|
|
||||||
dereference() const {
|
|
||||||
return (value ? value : value = (*f)()).get();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool equal(function_pointer_input_iterator const & other) const {
|
|
||||||
return f == other.f && state == other.state;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
Function f;
|
|
||||||
Input state;
|
|
||||||
mutable optional<typename function_types::result_type<Function>::type> value;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class Function, class Input>
|
|
||||||
class function_reference_input_iterator
|
|
||||||
: public function_pointer_input_iterator<Function*,Input>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
function_reference_input_iterator(Function & f_, Input state_ = Input())
|
|
||||||
: function_pointer_input_iterator<Function*,Input>(&f_, state_)
|
|
||||||
{}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace impl
|
|
||||||
|
|
||||||
template <class Function, class Input>
|
|
||||||
class function_input_iterator
|
|
||||||
: public mpl::if_<
|
|
||||||
function_types::is_function_pointer<Function>,
|
|
||||||
impl::function_pointer_input_iterator<Function,Input>,
|
|
||||||
typename mpl::if_<
|
|
||||||
function_types::is_function_reference<Function>,
|
|
||||||
impl::function_reference_input_iterator<Function,Input>,
|
|
||||||
impl::function_input_iterator<Function,Input>
|
|
||||||
>::type
|
|
||||||
>::type
|
|
||||||
{
|
|
||||||
typedef typename mpl::if_<
|
|
||||||
function_types::is_function_pointer<Function>,
|
|
||||||
impl::function_pointer_input_iterator<Function,Input>,
|
|
||||||
typename mpl::if_<
|
|
||||||
function_types::is_function_reference<Function>,
|
|
||||||
impl::function_reference_input_iterator<Function,Input>,
|
|
||||||
impl::function_input_iterator<Function,Input>
|
|
||||||
>::type
|
|
||||||
>::type base_type;
|
|
||||||
public:
|
|
||||||
function_input_iterator(Function & f, Input i)
|
|
||||||
: base_type(f, i) {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Function, class Input>
|
template <class Function, class Input>
|
||||||
inline function_input_iterator<Function, Input>
|
inline function_input_iterator<Function, Input>
|
||||||
make_function_input_iterator(Function & f, Input state) {
|
make_function_input_iterator(Function & f, Input state) {
|
||||||
typedef function_input_iterator<Function, Input> result_t;
|
typedef function_input_iterator<Function, Input> result_t;
|
||||||
return result_t(f, state);
|
return result_t(&f, state);
|
||||||
}
|
|
||||||
|
|
||||||
template <class Function, class Input>
|
|
||||||
inline function_input_iterator<Function*, Input>
|
|
||||||
make_function_input_iterator(Function * f, Input state) {
|
|
||||||
typedef function_input_iterator<Function*, Input> result_t;
|
|
||||||
return result_t(f, state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct infinite {
|
struct infinite {
|
||||||
|
0
include/boost/iterator/is_lvalue_iterator.hpp
Executable file → Normal file
0
include/boost/iterator/is_lvalue_iterator.hpp
Executable file → Normal file
0
include/boost/iterator/is_readable_iterator.hpp
Executable file → Normal file
0
include/boost/iterator/is_readable_iterator.hpp
Executable file → Normal file
@ -24,9 +24,15 @@
|
|||||||
|
|
||||||
#ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
|
#ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
|
||||||
# include <boost/type_traits/remove_reference.hpp>
|
# include <boost/type_traits/remove_reference.hpp>
|
||||||
|
|
||||||
|
# if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610))
|
||||||
|
# include <boost/type_traits/add_reference.hpp>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
# include <boost/type_traits/add_reference.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/type_traits/add_reference.hpp>
|
|
||||||
#include <boost/iterator/detail/config_def.hpp>
|
#include <boost/iterator/detail/config_def.hpp>
|
||||||
|
|
||||||
#include <boost/iterator/iterator_traits.hpp>
|
#include <boost/iterator/iterator_traits.hpp>
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
#include <boost/iterator/detail/facade_iterator_category.hpp>
|
#include <boost/iterator/detail/facade_iterator_category.hpp>
|
||||||
#include <boost/iterator/detail/enable_if.hpp>
|
#include <boost/iterator/detail/enable_if.hpp>
|
||||||
|
|
||||||
|
#include <boost/implicit_cast.hpp>
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
#include <boost/utility/addressof.hpp>
|
|
||||||
|
|
||||||
#include <boost/type_traits/is_same.hpp>
|
#include <boost/type_traits/is_same.hpp>
|
||||||
#include <boost/type_traits/add_const.hpp>
|
#include <boost/type_traits/add_const.hpp>
|
||||||
@ -147,7 +147,7 @@ namespace boost
|
|||||||
|
|
||||||
// Returning a mutable reference allows nonsense like
|
// Returning a mutable reference allows nonsense like
|
||||||
// (*r++).mutate(), but it imposes fewer assumptions about the
|
// (*r++).mutate(), but it imposes fewer assumptions about the
|
||||||
// behavior of the value_type. In particular, recall that
|
// behavior of the value_type. In particular, recall taht
|
||||||
// (*r).mutate() is legal if operator* returns by value.
|
// (*r).mutate() is legal if operator* returns by value.
|
||||||
value_type&
|
value_type&
|
||||||
operator*() const
|
operator*() const
|
||||||
@ -294,43 +294,46 @@ namespace boost
|
|||||||
|
|
||||||
// operator->() needs special support for input iterators to strictly meet the
|
// operator->() needs special support for input iterators to strictly meet the
|
||||||
// standard's requirements. If *i is not a reference type, we must still
|
// standard's requirements. If *i is not a reference type, we must still
|
||||||
// produce an lvalue to which a pointer can be formed. We do that by
|
// produce a lvalue to which a pointer can be formed. We do that by
|
||||||
// returning a proxy object containing an instance of the reference object.
|
// returning an instantiation of this special proxy class template.
|
||||||
template <class Reference, class Pointer>
|
template <class T>
|
||||||
struct operator_arrow_dispatch // proxy references
|
struct operator_arrow_proxy
|
||||||
{
|
{
|
||||||
struct proxy
|
operator_arrow_proxy(T const* px) : m_value(*px) {}
|
||||||
{
|
T* operator->() const { return &m_value; }
|
||||||
explicit proxy(Reference const & x) : m_ref(x) {}
|
// This function is needed for MWCW and BCC, which won't call operator->
|
||||||
Reference* operator->() { return boost::addressof(m_ref); }
|
// again automatically per 13.3.1.2 para 8
|
||||||
// This function is needed for MWCW and BCC, which won't call
|
operator T*() const { return &m_value; }
|
||||||
// operator-> again automatically per 13.3.1.2 para 8
|
mutable T m_value;
|
||||||
operator Reference*() { return boost::addressof(m_ref); }
|
|
||||||
Reference m_ref;
|
|
||||||
};
|
|
||||||
typedef proxy result_type;
|
|
||||||
static result_type apply(Reference const & x)
|
|
||||||
{
|
|
||||||
return result_type(x);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T, class Pointer>
|
// A metafunction that gets the result type for operator->. Also
|
||||||
struct operator_arrow_dispatch<T&, Pointer> // "real" references
|
// has a static function make() which builds the result from a
|
||||||
|
// Reference
|
||||||
|
template <class ValueType, class Reference, class Pointer>
|
||||||
|
struct operator_arrow_result
|
||||||
{
|
{
|
||||||
typedef Pointer result_type;
|
// CWPro8.3 won't accept "operator_arrow_result::type", and we
|
||||||
static result_type apply(T& x)
|
// need that type below, so metafunction forwarding would be a
|
||||||
|
// losing proposition here.
|
||||||
|
typedef typename mpl::if_<
|
||||||
|
is_reference<Reference>
|
||||||
|
, Pointer
|
||||||
|
, operator_arrow_proxy<ValueType>
|
||||||
|
>::type type;
|
||||||
|
|
||||||
|
static type make(Reference x)
|
||||||
{
|
{
|
||||||
return boost::addressof(x);
|
return implicit_cast<type>(&x);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||||
// Deal with ETI
|
// Deal with ETI
|
||||||
template<>
|
template<>
|
||||||
struct operator_arrow_dispatch<int, int>
|
struct operator_arrow_result<int, int, int>
|
||||||
{
|
{
|
||||||
typedef int result_type;
|
typedef int type;
|
||||||
};
|
};
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@ -615,10 +618,11 @@ namespace boost
|
|||||||
Value, CategoryOrTraversal, Reference, Difference
|
Value, CategoryOrTraversal, Reference, Difference
|
||||||
> associated_types;
|
> associated_types;
|
||||||
|
|
||||||
typedef boost::detail::operator_arrow_dispatch<
|
typedef boost::detail::operator_arrow_result<
|
||||||
Reference
|
typename associated_types::value_type
|
||||||
|
, Reference
|
||||||
, typename associated_types::pointer
|
, typename associated_types::pointer
|
||||||
> operator_arrow_dispatch_;
|
> pointer_;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// For use by derived classes
|
// For use by derived classes
|
||||||
@ -630,7 +634,7 @@ namespace boost
|
|||||||
typedef Reference reference;
|
typedef Reference reference;
|
||||||
typedef Difference difference_type;
|
typedef Difference difference_type;
|
||||||
|
|
||||||
typedef typename operator_arrow_dispatch_::result_type pointer;
|
typedef typename pointer_::type pointer;
|
||||||
|
|
||||||
typedef typename associated_types::iterator_category iterator_category;
|
typedef typename associated_types::iterator_category iterator_category;
|
||||||
|
|
||||||
@ -641,7 +645,7 @@ namespace boost
|
|||||||
|
|
||||||
pointer operator->() const
|
pointer operator->() const
|
||||||
{
|
{
|
||||||
return operator_arrow_dispatch_::apply(*this->derived());
|
return pointer_::make(*this->derived());
|
||||||
}
|
}
|
||||||
|
|
||||||
typename boost::detail::operator_brackets_result<Derived,Value,reference>::type
|
typename boost::detail::operator_brackets_result<Derived,Value,reference>::type
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
#ifndef BOOST_REVERSE_ITERATOR_23022003THW_HPP
|
#ifndef BOOST_REVERSE_ITERATOR_23022003THW_HPP
|
||||||
#define BOOST_REVERSE_ITERATOR_23022003THW_HPP
|
#define BOOST_REVERSE_ITERATOR_23022003THW_HPP
|
||||||
|
|
||||||
#include <boost/next_prior.hpp>
|
|
||||||
#include <boost/iterator.hpp>
|
#include <boost/iterator.hpp>
|
||||||
|
#include <boost/utility.hpp>
|
||||||
#include <boost/iterator/iterator_adaptor.hpp>
|
#include <boost/iterator/iterator_adaptor.hpp>
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
|
@ -42,11 +42,13 @@ namespace boost
|
|||||||
struct transform_iterator_base
|
struct transform_iterator_base
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
typedef typename std::iterator_traits<Iterator>::reference Arg1;
|
||||||
|
|
||||||
// By default, dereferencing the iterator yields the same as
|
// By default, dereferencing the iterator yields the same as
|
||||||
// the function.
|
// the function.
|
||||||
typedef typename ia_dflt_help<
|
typedef typename ia_dflt_help<
|
||||||
Reference
|
Reference
|
||||||
, result_of<const UnaryFunc(typename std::iterator_traits<Iterator>::reference)>
|
, result_of<UnaryFunc(typename std::iterator_traits<Iterator>::value_type)>
|
||||||
>::type reference;
|
>::type reference;
|
||||||
|
|
||||||
// To get the default for Value: remove any reference on the
|
// To get the default for Value: remove any reference on the
|
||||||
|
59
include/boost/pending/integer_range.hpp
Normal file
59
include/boost/pending/integer_range.hpp
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
// (C) Copyright David Abrahams and Jeremy Siek 2000-2001.
|
||||||
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
//
|
||||||
|
// Revision History:
|
||||||
|
// 04 Jan 2001 Factored counting_iterator stuff into
|
||||||
|
// boost/counting_iterator.hpp (David Abrahams)
|
||||||
|
|
||||||
|
#ifndef BOOST_INTEGER_RANGE_HPP_
|
||||||
|
#define BOOST_INTEGER_RANGE_HPP_
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/iterator/counting_iterator.hpp>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
// Counting Iterator and Integer Range Class
|
||||||
|
|
||||||
|
template <class IntegerType>
|
||||||
|
struct integer_range {
|
||||||
|
typedef counting_iterator<IntegerType> iterator;
|
||||||
|
|
||||||
|
typedef iterator const_iterator;
|
||||||
|
typedef IntegerType value_type;
|
||||||
|
typedef std::ptrdiff_t difference_type;
|
||||||
|
typedef IntegerType reference;
|
||||||
|
typedef IntegerType const_reference;
|
||||||
|
typedef const IntegerType* pointer;
|
||||||
|
typedef const IntegerType* const_pointer;
|
||||||
|
typedef IntegerType size_type;
|
||||||
|
|
||||||
|
integer_range(IntegerType start, IntegerType finish)
|
||||||
|
: m_start(start), m_finish(finish) { }
|
||||||
|
|
||||||
|
iterator begin() const { return iterator(m_start); }
|
||||||
|
iterator end() const { return iterator(m_finish); }
|
||||||
|
size_type size() const { return m_finish - m_start; }
|
||||||
|
bool empty() const { return m_finish == m_start; }
|
||||||
|
void swap(integer_range& x) {
|
||||||
|
std::swap(m_start, x.m_start);
|
||||||
|
std::swap(m_finish, x.m_finish);
|
||||||
|
}
|
||||||
|
protected:
|
||||||
|
IntegerType m_start, m_finish;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class IntegerType>
|
||||||
|
inline integer_range<IntegerType>
|
||||||
|
make_integer_range(IntegerType first, IntegerType last)
|
||||||
|
{
|
||||||
|
return integer_range<IntegerType>(first, last);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif // BOOST_INTEGER_RANGE_HPP_
|
@ -25,6 +25,7 @@
|
|||||||
# include <boost/static_assert.hpp>
|
# include <boost/static_assert.hpp>
|
||||||
# include <boost/concept_archetype.hpp> // for detail::dummy_constructor
|
# include <boost/concept_archetype.hpp> // for detail::dummy_constructor
|
||||||
# include <boost/implicit_cast.hpp>
|
# include <boost/implicit_cast.hpp>
|
||||||
|
# include <boost/type_traits/broken_compiler_spec.hpp>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
|
|
||||||
@ -40,6 +41,8 @@ struct dummyT {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_TT_BROKEN_COMPILER_SPEC(boost::dummyT)
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
|
|
||||||
// Tests whether type Iterator satisfies the requirements for a
|
// Tests whether type Iterator satisfies the requirements for a
|
||||||
|
0
include/boost/pointee.hpp
Executable file → Normal file
0
include/boost/pointee.hpp
Executable file → Normal file
0
index.html
Executable file → Normal file
0
index.html
Executable file → Normal file
@ -43,6 +43,5 @@ test-suite iterator
|
|||||||
[ run iterator_traits_test.cpp ]
|
[ run iterator_traits_test.cpp ]
|
||||||
[ run permutation_iterator_test.cpp : : : # <stlport-iostream>on
|
[ run permutation_iterator_test.cpp : : : # <stlport-iostream>on
|
||||||
]
|
]
|
||||||
[ run function_input_iterator_test.cpp ]
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
0
test/constant_iter_arrow.cpp
Executable file → Normal file
0
test/constant_iter_arrow.cpp
Executable file → Normal file
0
test/constant_iter_arrow_fail.cpp
Executable file → Normal file
0
test/constant_iter_arrow_fail.cpp
Executable file → Normal file
@ -1,101 +0,0 @@
|
|||||||
// Copyright 2010 (c) Dean Michael Berris
|
|
||||||
// Distributed under the Boost Software License Version 1.0.
|
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
#include <cstddef>
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <iostream>
|
|
||||||
#include <iterator>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <boost/iterator/function_input_iterator.hpp>
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
struct ones {
|
|
||||||
typedef int result_type;
|
|
||||||
result_type operator() () {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
int ones_function () {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct counter {
|
|
||||||
typedef int result_type;
|
|
||||||
int n;
|
|
||||||
explicit counter(int n_) : n(n_) { }
|
|
||||||
result_type operator() () {
|
|
||||||
return n++;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
int main(int argc, char * argv[])
|
|
||||||
{
|
|
||||||
// test the iterator with function objects
|
|
||||||
ones ones_generator;
|
|
||||||
vector<int> values(10);
|
|
||||||
generate(values.begin(), values.end(), ones());
|
|
||||||
|
|
||||||
vector<int> generated;
|
|
||||||
copy(
|
|
||||||
boost::make_function_input_iterator(ones_generator, 0),
|
|
||||||
boost::make_function_input_iterator(ones_generator, 10),
|
|
||||||
back_inserter(generated)
|
|
||||||
);
|
|
||||||
|
|
||||||
assert(values.size() == generated.size());
|
|
||||||
assert(equal(values.begin(), values.end(), generated.begin()));
|
|
||||||
cout << "function iterator test with function objects successful." << endl;
|
|
||||||
|
|
||||||
// test the iterator with normal functions
|
|
||||||
vector<int>().swap(generated);
|
|
||||||
copy(
|
|
||||||
boost::make_function_input_iterator(&ones_function, 0),
|
|
||||||
boost::make_function_input_iterator(&ones_function, 10),
|
|
||||||
back_inserter(generated)
|
|
||||||
);
|
|
||||||
|
|
||||||
assert(values.size() == generated.size());
|
|
||||||
assert(equal(values.begin(), values.end(), generated.begin()));
|
|
||||||
cout << "function iterator test with pointer to function successful." << endl;
|
|
||||||
|
|
||||||
// test the iterator with a reference to a function
|
|
||||||
vector<int>().swap(generated);
|
|
||||||
copy(
|
|
||||||
boost::make_function_input_iterator(ones_function, 0),
|
|
||||||
boost::make_function_input_iterator(ones_function, 10),
|
|
||||||
back_inserter(generated)
|
|
||||||
);
|
|
||||||
|
|
||||||
assert(values.size() == generated.size());
|
|
||||||
assert(equal(values.begin(), values.end(), generated.begin()));
|
|
||||||
cout << "function iterator test with reference to function successful." << endl;
|
|
||||||
|
|
||||||
// test the iterator with a stateful function object
|
|
||||||
counter counter_generator(42);
|
|
||||||
vector<int>().swap(generated);
|
|
||||||
copy(
|
|
||||||
boost::make_function_input_iterator(counter_generator, 0),
|
|
||||||
boost::make_function_input_iterator(counter_generator, 10),
|
|
||||||
back_inserter(generated)
|
|
||||||
);
|
|
||||||
|
|
||||||
assert(generated.size() == 10);
|
|
||||||
assert(counter_generator.n == 42 + 10);
|
|
||||||
for(std::size_t i = 0; i != 10; ++i)
|
|
||||||
assert(generated[i] == 42 + i);
|
|
||||||
cout << "function iterator test with stateful function object successful." << endl;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
|||||||
//
|
|
||||||
// Copyright 2014 Peter Dimov
|
|
||||||
//
|
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
|
||||||
// See accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
// http://www.boost.org/LICENSE_1_0.txt
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <boost/generator_iterator.hpp>
|
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
class X
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
|
|
||||||
int v;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
typedef int result_type;
|
|
||||||
|
|
||||||
X(): v( 0 )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int operator()()
|
|
||||||
{
|
|
||||||
return ++v;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class InputIterator, class Size, class OutputIterator> OutputIterator copy_n( InputIterator first, Size n, OutputIterator result )
|
|
||||||
{
|
|
||||||
while( n-- > 0 )
|
|
||||||
{
|
|
||||||
*result++ = *first++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void copy_test()
|
|
||||||
{
|
|
||||||
X x;
|
|
||||||
boost::generator_iterator<X> in( &x );
|
|
||||||
|
|
||||||
int const N = 4;
|
|
||||||
int v[ N ] = { 0 };
|
|
||||||
|
|
||||||
::copy_n( in, 4, v );
|
|
||||||
|
|
||||||
BOOST_TEST_EQ( v[0], 1 );
|
|
||||||
BOOST_TEST_EQ( v[1], 2 );
|
|
||||||
BOOST_TEST_EQ( v[2], 3 );
|
|
||||||
BOOST_TEST_EQ( v[3], 4 );
|
|
||||||
}
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
copy_test();
|
|
||||||
return boost::report_errors();
|
|
||||||
}
|
|
@ -27,6 +27,8 @@ struct my_ptr {
|
|||||||
// typedef boost::no_traversal_tag iterator_category;
|
// typedef boost::no_traversal_tag iterator_category;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BOOST_TT_BROKEN_COMPILER_SPEC(my_ptr)
|
||||||
|
BOOST_TT_BROKEN_COMPILER_SPEC(zow)
|
||||||
|
|
||||||
// Borland 5.6.4 and earlier drop const all over the place, so this
|
// Borland 5.6.4 and earlier drop const all over the place, so this
|
||||||
// test will fail in the lines marked with (**)
|
// test will fail in the lines marked with (**)
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#include <boost/mpl/has_xxx.hpp>
|
#include <boost/mpl/has_xxx.hpp>
|
||||||
|
|
||||||
|
#include <boost/type_traits/broken_compiler_spec.hpp>
|
||||||
|
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -51,6 +53,7 @@ template <int I> struct see_val;
|
|||||||
struct my_iterator_tag : public std::random_access_iterator_tag { };
|
struct my_iterator_tag : public std::random_access_iterator_tag { };
|
||||||
|
|
||||||
using boost::dummyT;
|
using boost::dummyT;
|
||||||
|
BOOST_TT_BROKEN_COMPILER_SPEC(boost::shared_ptr<dummyT>)
|
||||||
|
|
||||||
typedef std::vector<int> storage;
|
typedef std::vector<int> storage;
|
||||||
typedef std::vector<int*> pointer_ra_container;
|
typedef std::vector<int*> pointer_ra_container;
|
||||||
|
0
test/interoperable.cpp
Executable file → Normal file
0
test/interoperable.cpp
Executable file → Normal file
@ -7,6 +7,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
#include <boost/noncopyable.hpp>
|
#include <boost/noncopyable.hpp>
|
||||||
|
#include <boost/type_traits/broken_compiler_spec.hpp>
|
||||||
#include <boost/iterator/is_lvalue_iterator.hpp>
|
#include <boost/iterator/is_lvalue_iterator.hpp>
|
||||||
#include <boost/iterator.hpp>
|
#include <boost/iterator.hpp>
|
||||||
|
|
||||||
@ -19,6 +20,7 @@ struct v
|
|||||||
~v();
|
~v();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BOOST_TT_BROKEN_COMPILER_SPEC(v)
|
||||||
|
|
||||||
struct value_iterator : boost::iterator<std::input_iterator_tag,v>
|
struct value_iterator : boost::iterator<std::input_iterator_tag,v>
|
||||||
{
|
{
|
||||||
@ -81,6 +83,8 @@ struct constant_lvalue_iterator
|
|||||||
constant_lvalue_iterator operator++(int);
|
constant_lvalue_iterator operator++(int);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BOOST_TT_BROKEN_COMPILER_SPEC(proxy_iterator<v>::proxy)
|
||||||
|
BOOST_TT_BROKEN_COMPILER_SPEC(proxy_iterator<int>::proxy)
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
#include <boost/noncopyable.hpp>
|
#include <boost/noncopyable.hpp>
|
||||||
|
#include <boost/type_traits/broken_compiler_spec.hpp>
|
||||||
#include <boost/iterator/is_readable_iterator.hpp>
|
#include <boost/iterator/is_readable_iterator.hpp>
|
||||||
#include <boost/iterator.hpp>
|
#include <boost/iterator.hpp>
|
||||||
|
|
||||||
@ -19,6 +20,7 @@ struct v
|
|||||||
~v();
|
~v();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BOOST_TT_BROKEN_COMPILER_SPEC(v)
|
||||||
|
|
||||||
struct value_iterator : boost::iterator<std::input_iterator_tag,v>
|
struct value_iterator : boost::iterator<std::input_iterator_tag,v>
|
||||||
{
|
{
|
||||||
@ -69,6 +71,7 @@ struct proxy_iterator2 : boost::iterator<std::output_iterator_tag,v>
|
|||||||
proxy operator*() const;
|
proxy operator*() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BOOST_TT_BROKEN_COMPILER_SPEC(proxy_iterator::proxy)
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
0
test/iter_archetype_default_ctor.cpp
Executable file → Normal file
0
test/iter_archetype_default_ctor.cpp
Executable file → Normal file
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user