Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/iterator/doc/ref_problem.html @ 12

Last change on this file since 12 was 12, checked in by landauf, 18 years ago

added boost

  • Property svn:executable set to *
File size: 4.9 KB
Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6<meta name="generator" content="Docutils 0.3.6: http://docutils.sourceforge.net/" />
7<title>Problem with reference and old/new iterator category correspondance</title>
8<link rel="stylesheet" href="default.css" type="text/css" />
9</head>
10<body>
11<h1 class="title">Problem with <tt class="literal"><span class="pre">reference</span></tt> and old/new iterator category correspondance</h1>
12<div class="document" id="problem-with-reference-and-old-new-iterator-category-correspondance">
13<table class="field-list" frame="void" rules="none">
14<col class="field-name" />
15<col class="field-body" />
16<tbody valign="top">
17<tr class="field"><th class="field-name">Author:</th><td class="field-body">David Abrahams and Jeremy Siek</td>
18</tr>
19<tr class="field"><th class="field-name">Contact:</th><td class="field-body"><a class="reference" href="mailto:dave&#64;boost-consulting.com">dave&#64;boost-consulting.com</a>, <a class="reference" href="mailto:jsiek&#64;osl.iu.edu">jsiek&#64;osl.iu.edu</a></td>
20</tr>
21<tr class="field"><th class="field-name">Organization:</th><td class="field-body"><a class="reference" href="http://www.boost-consulting.com">Boost Consulting</a>, Indiana University Bloomington</td>
22</tr>
23<tr class="field"><th class="field-name">date:</th><td class="field-body">$Date: 2004/11/02 14:31:13 $</td>
24</tr>
25<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Copyright David Abrahams, Jeremy Siek 2003. Use, modification and
26distribution is subject to the Boost Software License,
27Version 1.0. (See accompanying file LICENSE_1_0.txt or copy
28at <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</td>
29</tr>
30</tbody>
31</table>
32<div class="section" id="introduction">
33<h1><a name="introduction">Introduction</a></h1>
34<p>The new iterator categories are intended to correspond to the old
35iterator categories, as specified in a diagram in <a class="reference" href="http://www.boost-consulting.com/writing/n1550.html">N1550</a>. For example,
36an iterator categorized as a mutable Forward Iterator under the old
37scheme is now a Writable, Lvalue, and Foward Traversal iterator.
38However, there is a problem with this correspondance, the new iterator
39categories place requirements on the <tt class="literal"><span class="pre">iterator_traits&lt;X&gt;::reference</span></tt>
40type whereas the standard iterator requirements say nothing about the
41<tt class="literal"><span class="pre">reference</span></tt> type . In particular, the new Readable Iterator
42requirements say that the return type of <tt class="literal"><span class="pre">*a</span></tt> must be
43<tt class="literal"><span class="pre">iterator_traits&lt;X&gt;::reference</span></tt> and the Lvalue Iterator requirements
44says that <tt class="literal"><span class="pre">iterator_traits&lt;X&gt;::reference</span></tt> must be <tt class="literal"><span class="pre">T&amp;</span></tt> or <tt class="literal"><span class="pre">const</span>
45<span class="pre">T&amp;</span></tt>.</p>
46</div>
47<div class="section" id="proposed-resolution">
48<h1><a name="proposed-resolution">Proposed Resolution</a></h1>
49<p>Change the standard requirements to match the requirements of the new
50iterators. (more details to come)</p>
51</div>
52<div class="section" id="rationale">
53<h1><a name="rationale">Rationale</a></h1>
54<p>The lack of specification in the standard of the <tt class="literal"><span class="pre">reference</span></tt> type is
55certainly a defect. Without specification, it is entirely useless in a
56generic function. The current practice in the community is generally
57to assume there are requirements on the <tt class="literal"><span class="pre">reference</span></tt> type, such as
58those proposed in the new iterator categories.</p>
59<p>There is some danger in <em>adding</em> requirements to existing concepts.
60This will mean that some existing iterator types will no longer meet
61the iterator requirements. However, we feel that the impact of this is
62small enough to warrant going ahead with this change.</p>
63<p>An alternative solution would be to leave the standard requirements as
64is, and to remove the requirements for the <tt class="literal"><span class="pre">reference</span></tt> type in the
65new iterator concepts. We are not in favor of this approach because it
66extends what we see as a defect further into the future.</p>
67</div>
68</div>
69<hr class="footer" />
70<div class="footer">
71<a class="reference" href="ref_problem.rst">View document source</a>.
72Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
73</div>
74</body>
75</html>
Note: See TracBrowser for help on using the repository browser.