mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-09 23:23:54 +00:00
76 lines
4.9 KiB
HTML
Executable File
76 lines
4.9 KiB
HTML
Executable File
<?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.3.6: 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>
|
|
<h1 class="title">Problem with <tt class="literal"><span class="pre">reference</span></tt> and old/new iterator category correspondance</h1>
|
|
<div class="document" id="problem-with-reference-and-old-new-iterator-category-correspondance">
|
|
<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@boost-consulting.com">dave@boost-consulting.com</a>, <a class="reference" href="mailto:jsiek@osl.iu.edu">jsiek@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$</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<X>::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<X>::reference</span></tt> and the Lvalue Iterator requirements
|
|
says that <tt class="literal"><span class="pre">iterator_traits<X>::reference</span></tt> must be <tt class="literal"><span class="pre">T&</span></tt> or <tt class="literal"><span class="pre">const</span>
|
|
<span class="pre">T&</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>
|
|
<hr class="footer" />
|
|
<div class="footer">
|
|
<a class="reference" href="ref_problem.rst">View document source</a>.
|
|
Generated 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.
|
|
</div>
|
|
</body>
|
|
</html>
|