Sophie

Sophie

distrib > Mandriva > 10.0 > i586 > by-pkgid > ef9bad9e14fc2a68cb7c992c11d75f5e > files > 2930

libboost1-devel-1.31.0-1mdk.i586.rpm

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.2.8: http://docutils.sourceforge.net/" />
<title>Problem with reference and old/new iterator category correspondance</title>
<link rel="stylesheet" href="default.css" type="text/css" />
</head>
<body>
<div class="document" id="problem-with-reference-and-old-new-iterator-category-correspondance">
<h1 class="title">Problem with <tt class="literal"><span class="pre">reference</span></tt> and old/new iterator category correspondance</h1>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Author:</th><td class="field-body">David Abrahams and Jeremy Siek</td>
</tr>
<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>
</tr>
<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>
</tr>
<tr class="field"><th class="field-name">date:</th><td class="field-body">$Date: 2004/01/27 17:03:46 $</td>
</tr>
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Copyright David Abrahams, Jeremy Siek 2003. Use, modification and
distribution is subject to the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt or copy
at <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</td>
</tr>
</tbody>
</table>
<div class="section" id="introduction">
<h1><a name="introduction">Introduction</a></h1>
<p>The new iterator categories are intended to correspond to the old
iterator categories, as specified in a diagram in <a class="reference" href="http://www.boost-consulting.com/writing/n1550.html">N1550</a>. For example,
an iterator categorized as a mutable Forward Iterator under the old
scheme is now a Writable, Lvalue, and Foward Traversal iterator.
However, there is a problem with this correspondance, the new iterator
categories place requirements on the <tt class="literal"><span class="pre">iterator_traits&lt;X&gt;::reference</span></tt>
type whereas the standard iterator requirements say nothing about the
<tt class="literal"><span class="pre">reference</span></tt> type . In particular, the new Readable Iterator
requirements say that the return type of <tt class="literal"><span class="pre">*a</span></tt> must be
<tt class="literal"><span class="pre">iterator_traits&lt;X&gt;::reference</span></tt> and the Lvalue Iterator requirements
says 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>
<span class="pre">T&amp;</span></tt>.</p>
</div>
<div class="section" id="proposed-resolution">
<h1><a name="proposed-resolution">Proposed Resolution</a></h1>
<p>Change the standard requirements to match the requirements of the new
iterators. (more details to come)</p>
</div>
<div class="section" id="rationale">
<h1><a name="rationale">Rationale</a></h1>
<p>The lack of specification in the standard of the <tt class="literal"><span class="pre">reference</span></tt> type is
certainly a defect. Without specification, it is entirely useless in a
generic function. The current practice in the community is generally
to assume there are requirements on the <tt class="literal"><span class="pre">reference</span></tt> type, such as
those proposed in the new iterator categories.</p>
<p>There is some danger in <em>adding</em> requirements to existing concepts.
This will mean that some existing iterator types will no longer meet
the iterator requirements. However, we feel that the impact of this is
small enough to warrant going ahead with this change.</p>
<p>An alternative solution would be to leave the standard requirements as
is, and to remove the requirements for the <tt class="literal"><span class="pre">reference</span></tt> type in the
new iterator concepts. We are not in favor of this approach because it
extends what we see as a defect further into the future.</p>
</div>
</div>
</body>
</html>