73 lines
5.1 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Upgrading from the old Boost Iterator Adaptor Library</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Boost.Iterator">
<link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Boost.Iterator">
<link rel="prev" href="utilities/utilities/utilities_testing.html" title="Testing and Concept Checking">
<link rel="next" href="history.html" title="History">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
<td align="center"><a href="../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="utilities/utilities/utilities_testing.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="history.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="iterator.upgrading"></a><a class="link" href="upgrading.html" title="Upgrading from the old Boost Iterator Adaptor Library">Upgrading from the old Boost Iterator
Adaptor Library</a>
</h2></div></div></div>
<p>
If you have been using the old Boost Iterator Adaptor library to implement
iterators, you probably wrote a <code class="computeroutput"><span class="identifier">Policies</span></code>
class which captures the core operations of your iterator. In the new library
design, you'll move those same core operations into the body of the iterator
class itself. If you were writing a family of iterators, you probably wrote
a <a href="http://www.boost.org/more/generic_programming.html#type_generator" target="_top">type
generator</a> to build the <code class="computeroutput"><span class="identifier">iterator_adaptor</span></code>
specialization you needed; in the new library design you don't need a type
generator (though may want to keep it around as a compatibility aid for older
code) because, due to the use of the Curiously Recurring Template Pattern (CRTP)
[Cop95]_, you can now define the iterator class yourself and acquire functionality
through inheritance from <code class="computeroutput"><span class="identifier">iterator_facade</span></code>
or <code class="computeroutput"><span class="identifier">iterator_adaptor</span></code>. As a result,
you also get much finer control over how your iterator works: you can add additional
constructors, or even override the iterator functionality provided by the library.
</p>
<p>
If you're looking for the old <code class="computeroutput"><span class="identifier">projection_iterator</span></code>
component, its functionality has been merged into <span class="underline">transform_iterator</span>:
as long as the function object's <code class="computeroutput"><span class="identifier">result_type</span></code>
(or the <code class="computeroutput"><span class="identifier">Reference</span></code> template
argument, if explicitly specified) is a true reference type, <span class="underline">transform_iterator</span>
will behave like <code class="computeroutput"><span class="identifier">projection_iterator</span></code>
used to.
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2003, 2005 David Abrahams Jeremy Siek Thomas
Witt<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at &lt;ulink url="http://www.boost.org/LICENSE_1_0.txt"&gt;
http://www.boost.org/LICENSE_1_0.txt &lt;/ulink&gt;)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="utilities/utilities/utilities_testing.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="history.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>