• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Upgrading from the old Boost Iterator Adaptor Library</title>
5<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../index.html" title="Chapter 1. Boost.Iterator">
8<link rel="up" href="../index.html" title="Chapter 1. Boost.Iterator">
9<link rel="prev" href="algorithms/next_prior.html" title="Function templates next() and prior()">
10<link rel="next" href="history.html" title="History">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="algorithms/next_prior.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>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h2 class="title" style="clear: both">
27<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
28    Adaptor Library</a>
29</h2></div></div></div>
30<p>
31      If you have been using the old Boost Iterator Adaptor library to implement
32      iterators, you probably wrote a <code class="computeroutput"><span class="identifier">Policies</span></code>
33      class which captures the core operations of your iterator. In the new library
34      design, you'll move those same core operations into the body of the iterator
35      class itself. If you were writing a family of iterators, you probably wrote
36      a <a href="http://www.boost.org/more/generic_programming.html#type_generator" target="_top">type
37      generator</a> to build the <code class="computeroutput"><span class="identifier">iterator_adaptor</span></code>
38      specialization you needed; in the new library design you don't need a type
39      generator (though may want to keep it around as a compatibility aid for older
40      code) because, due to the use of the Curiously Recurring Template Pattern (CRTP)
41      [Cop95]_, you can now define the iterator class yourself and acquire functionality
42      through inheritance from <code class="computeroutput"><span class="identifier">iterator_facade</span></code>
43      or <code class="computeroutput"><span class="identifier">iterator_adaptor</span></code>. As a result,
44      you also get much finer control over how your iterator works: you can add additional
45      constructors, or even override the iterator functionality provided by the library.
46    </p>
47<p>
48      If you're looking for the old <code class="computeroutput"><span class="identifier">projection_iterator</span></code>
49      component, its functionality has been merged into <span class="underline">transform_iterator</span>:
50      as long as the function object's <code class="computeroutput"><span class="identifier">result_type</span></code>
51      (or the <code class="computeroutput"><span class="identifier">Reference</span></code> template
52      argument, if explicitly specified) is a true reference type, <span class="underline">transform_iterator</span>
53      will behave like <code class="computeroutput"><span class="identifier">projection_iterator</span></code>
54      used to.
55    </p>
56</div>
57<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
58<td align="left"></td>
59<td align="right"><div class="copyright-footer">Copyright © 2003, 2005 David Abrahams Jeremy Siek Thomas
60      Witt<p>
61        Distributed under the Boost Software License, Version 1.0. (See accompanying
62        file LICENSE_1_0.txt or copy at &lt;ulink url="http://www.boost.org/LICENSE_1_0.txt"&gt;
63        http://www.boost.org/LICENSE_1_0.txt &lt;/ulink&gt;)
64      </p>
65</div></td>
66</tr></table>
67<hr>
68<div class="spirit-nav">
69<a accesskey="p" href="algorithms/next_prior.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>
70</div>
71</body>
72</html>
73