mirror of
https://github.com/boostorg/iterator.git
synced 2025-07-29 12:27:33 +02:00
new version
[SVN r20852]
This commit is contained in:
303
doc/issues.html
303
doc/issues.html
@ -3,200 +3,9 @@
|
|||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
<meta name="generator" content="Docutils 0.2.8: http://docutils.sourceforge.net/" />
|
||||||
<title>Problem with is_writable and is_swappable in N1550</title>
|
<title>Problem with is_writable and is_swappable in N1550</title>
|
||||||
<style type="text/css"><!--
|
<link rel="stylesheet" href="default.css" type="text/css" />
|
||||||
|
|
||||||
/*
|
|
||||||
:Author: David Goodger
|
|
||||||
:Contact: goodger@users.sourceforge.net
|
|
||||||
:date: $Date$
|
|
||||||
:version: $Revision$
|
|
||||||
:copyright: This stylesheet has been placed in the public domain.
|
|
||||||
|
|
||||||
Default cascading style sheet for the HTML output of Docutils.
|
|
||||||
*/
|
|
||||||
|
|
||||||
.first {
|
|
||||||
margin-top: 0 }
|
|
||||||
|
|
||||||
.last {
|
|
||||||
margin-bottom: 0 }
|
|
||||||
|
|
||||||
a.toc-backref {
|
|
||||||
text-decoration: none ;
|
|
||||||
color: black }
|
|
||||||
|
|
||||||
dd {
|
|
||||||
margin-bottom: 0.5em }
|
|
||||||
|
|
||||||
div.abstract {
|
|
||||||
margin: 2em 5em }
|
|
||||||
|
|
||||||
div.abstract p.topic-title {
|
|
||||||
font-weight: bold ;
|
|
||||||
text-align: center }
|
|
||||||
|
|
||||||
div.attention, div.caution, div.danger, div.error, div.hint,
|
|
||||||
div.important, div.note, div.tip, div.warning {
|
|
||||||
margin: 2em ;
|
|
||||||
border: medium outset ;
|
|
||||||
padding: 1em }
|
|
||||||
|
|
||||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
|
||||||
div.danger p.admonition-title, div.error p.admonition-title,
|
|
||||||
div.warning p.admonition-title {
|
|
||||||
color: red ;
|
|
||||||
font-weight: bold ;
|
|
||||||
font-family: sans-serif }
|
|
||||||
|
|
||||||
div.hint p.admonition-title, div.important p.admonition-title,
|
|
||||||
div.note p.admonition-title, div.tip p.admonition-title {
|
|
||||||
font-weight: bold ;
|
|
||||||
font-family: sans-serif }
|
|
||||||
|
|
||||||
div.dedication {
|
|
||||||
margin: 2em 5em ;
|
|
||||||
text-align: center ;
|
|
||||||
font-style: italic }
|
|
||||||
|
|
||||||
div.dedication p.topic-title {
|
|
||||||
font-weight: bold ;
|
|
||||||
font-style: normal }
|
|
||||||
|
|
||||||
div.figure {
|
|
||||||
margin-left: 2em }
|
|
||||||
|
|
||||||
div.footer, div.header {
|
|
||||||
font-size: smaller }
|
|
||||||
|
|
||||||
div.system-messages {
|
|
||||||
margin: 5em }
|
|
||||||
|
|
||||||
div.system-messages h1 {
|
|
||||||
color: red }
|
|
||||||
|
|
||||||
div.system-message {
|
|
||||||
border: medium outset ;
|
|
||||||
padding: 1em }
|
|
||||||
|
|
||||||
div.system-message p.system-message-title {
|
|
||||||
color: red ;
|
|
||||||
font-weight: bold }
|
|
||||||
|
|
||||||
div.topic {
|
|
||||||
margin: 2em }
|
|
||||||
|
|
||||||
h1.title {
|
|
||||||
text-align: center }
|
|
||||||
|
|
||||||
h2.subtitle {
|
|
||||||
text-align: center }
|
|
||||||
|
|
||||||
hr {
|
|
||||||
width: 75% }
|
|
||||||
|
|
||||||
ol.simple, ul.simple {
|
|
||||||
margin-bottom: 1em }
|
|
||||||
|
|
||||||
ol.arabic {
|
|
||||||
list-style: decimal }
|
|
||||||
|
|
||||||
ol.loweralpha {
|
|
||||||
list-style: lower-alpha }
|
|
||||||
|
|
||||||
ol.upperalpha {
|
|
||||||
list-style: upper-alpha }
|
|
||||||
|
|
||||||
ol.lowerroman {
|
|
||||||
list-style: lower-roman }
|
|
||||||
|
|
||||||
ol.upperroman {
|
|
||||||
list-style: upper-roman }
|
|
||||||
|
|
||||||
p.caption {
|
|
||||||
font-style: italic }
|
|
||||||
|
|
||||||
p.credits {
|
|
||||||
font-style: italic ;
|
|
||||||
font-size: smaller }
|
|
||||||
|
|
||||||
p.label {
|
|
||||||
white-space: nowrap }
|
|
||||||
|
|
||||||
p.topic-title {
|
|
||||||
font-weight: bold }
|
|
||||||
|
|
||||||
pre.address {
|
|
||||||
margin-bottom: 0 ;
|
|
||||||
margin-top: 0 ;
|
|
||||||
font-family: serif ;
|
|
||||||
font-size: 100% }
|
|
||||||
|
|
||||||
pre.line-block {
|
|
||||||
font-family: serif ;
|
|
||||||
font-size: 100% }
|
|
||||||
|
|
||||||
pre.literal-block, pre.doctest-block {
|
|
||||||
margin-left: 2em ;
|
|
||||||
margin-right: 2em ;
|
|
||||||
background-color: #eeeeee }
|
|
||||||
|
|
||||||
span.classifier {
|
|
||||||
font-family: sans-serif ;
|
|
||||||
font-style: oblique }
|
|
||||||
|
|
||||||
span.classifier-delimiter {
|
|
||||||
font-family: sans-serif ;
|
|
||||||
font-weight: bold }
|
|
||||||
|
|
||||||
span.interpreted {
|
|
||||||
font-family: sans-serif }
|
|
||||||
|
|
||||||
span.option-argument {
|
|
||||||
font-style: italic }
|
|
||||||
|
|
||||||
span.pre {
|
|
||||||
white-space: pre }
|
|
||||||
|
|
||||||
span.problematic {
|
|
||||||
color: red }
|
|
||||||
|
|
||||||
table {
|
|
||||||
margin-top: 0.5em ;
|
|
||||||
margin-bottom: 0.5em }
|
|
||||||
|
|
||||||
table.citation {
|
|
||||||
border-left: solid thin gray ;
|
|
||||||
padding-left: 0.5ex }
|
|
||||||
|
|
||||||
table.docinfo {
|
|
||||||
margin: 2em 4em }
|
|
||||||
|
|
||||||
table.footnote {
|
|
||||||
border-left: solid thin black ;
|
|
||||||
padding-left: 0.5ex }
|
|
||||||
|
|
||||||
td, th {
|
|
||||||
padding-left: 0.5em ;
|
|
||||||
padding-right: 0.5em ;
|
|
||||||
vertical-align: top }
|
|
||||||
|
|
||||||
th.docinfo-name, th.field-name {
|
|
||||||
font-weight: bold ;
|
|
||||||
text-align: left ;
|
|
||||||
white-space: nowrap }
|
|
||||||
|
|
||||||
h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
|
|
||||||
font-size: 100% }
|
|
||||||
|
|
||||||
tt {
|
|
||||||
background-color: #eeeeee }
|
|
||||||
|
|
||||||
ul.auto-toc {
|
|
||||||
list-style-type: none }
|
|
||||||
|
|
||||||
--></style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="document" id="problem-with-is-writable-and-is-swappable-in-n1550">
|
<div class="document" id="problem-with-is-writable-and-is-swappable-in-n1550">
|
||||||
@ -223,13 +32,13 @@ at <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">http://www.b
|
|||||||
<div class="contents topic" id="table-of-contents">
|
<div class="contents topic" id="table-of-contents">
|
||||||
<p class="topic-title"><a name="table-of-contents">Table of Contents</a></p>
|
<p class="topic-title"><a name="table-of-contents">Table of Contents</a></p>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li><a class="reference" href="#introduction" id="id3" name="id3">Introduction</a></li>
|
<li><a class="reference" href="#introduction" id="id1" name="id1">Introduction</a></li>
|
||||||
<li><a class="reference" href="#proposed-resolution" id="id4" name="id4">Proposed Resolution</a></li>
|
<li><a class="reference" href="#proposed-resolution" id="id2" name="id2">Proposed Resolution</a></li>
|
||||||
<li><a class="reference" href="#rationale" id="id5" name="id5">Rationale</a></li>
|
<li><a class="reference" href="#rationale" id="id3" name="id3">Rationale</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="introduction">
|
<div class="section" id="introduction">
|
||||||
<h1><a class="toc-backref" href="#id3" name="introduction">Introduction</a></h1>
|
<h1><a class="toc-backref" href="#id1" name="introduction">Introduction</a></h1>
|
||||||
<p>The <tt class="literal"><span class="pre">is_writable</span></tt> and <tt class="literal"><span class="pre">is_swappable</span></tt> traits classes in <a class="reference" href="http://www.boost-consulting.com/writing/n1550.html">N1550</a>
|
<p>The <tt class="literal"><span class="pre">is_writable</span></tt> and <tt class="literal"><span class="pre">is_swappable</span></tt> traits classes in <a class="reference" href="http://www.boost-consulting.com/writing/n1550.html">N1550</a>
|
||||||
provide a mechanism for determining at compile time if an iterator
|
provide a mechanism for determining at compile time if an iterator
|
||||||
type is a model of the new Writable Iterator and Swappable Iterator
|
type is a model of the new Writable Iterator and Swappable Iterator
|
||||||
@ -271,7 +80,7 @@ attempting to write into <tt class="literal"><span class="pre">B</span></tt> wil
|
|||||||
<p>The same problem applies to <tt class="literal"><span class="pre">is_swappable</span></tt>.</p>
|
<p>The same problem applies to <tt class="literal"><span class="pre">is_swappable</span></tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="proposed-resolution">
|
<div class="section" id="proposed-resolution">
|
||||||
<h1><a class="toc-backref" href="#id4" name="proposed-resolution">Proposed Resolution</a></h1>
|
<h1><a class="toc-backref" href="#id2" name="proposed-resolution">Proposed Resolution</a></h1>
|
||||||
<ol class="arabic">
|
<ol class="arabic">
|
||||||
<li><p class="first">Remove the <tt class="literal"><span class="pre">is_writable</span></tt> and <tt class="literal"><span class="pre">is_swappable</span></tt> traits, and remove the
|
<li><p class="first">Remove the <tt class="literal"><span class="pre">is_writable</span></tt> and <tt class="literal"><span class="pre">is_swappable</span></tt> traits, and remove the
|
||||||
requirements in the Writable Iterator and Swappable Iterator concepts
|
requirements in the Writable Iterator and Swappable Iterator concepts
|
||||||
@ -281,68 +90,14 @@ that require their models to support these traits.</p>
|
|||||||
<tt class="literal"><span class="pre">is_readable<X>::type</span></tt> is <tt class="literal"><span class="pre">true_type</span></tt> if the
|
<tt class="literal"><span class="pre">is_readable<X>::type</span></tt> is <tt class="literal"><span class="pre">true_type</span></tt> if the
|
||||||
result type of <tt class="literal"><span class="pre">X::operator*</span></tt> is convertible to
|
result type of <tt class="literal"><span class="pre">X::operator*</span></tt> is convertible to
|
||||||
<tt class="literal"><span class="pre">iterator_traits<X>::value_type</span></tt> and is <tt class="literal"><span class="pre">false_type</span></tt>
|
<tt class="literal"><span class="pre">iterator_traits<X>::value_type</span></tt> and is <tt class="literal"><span class="pre">false_type</span></tt>
|
||||||
otherwise.</p>
|
otherwise. Also, <tt class="literal"><span class="pre">is_readable</span></tt> is required to satisfy
|
||||||
|
the requirements for the UnaryTypeTrait concept
|
||||||
|
(defined in the type traits proposal).</p>
|
||||||
<p>Remove the requirement for support of the <tt class="literal"><span class="pre">is_readable</span></tt> trait from
|
<p>Remove the requirement for support of the <tt class="literal"><span class="pre">is_readable</span></tt> trait from
|
||||||
the Readable Iterator concept.</p>
|
the Readable Iterator concept.</p>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
<li><p class="first">Remove the <tt class="literal"><span class="pre">iterator_tag</span></tt> class.</p>
|
||||||
<!-- We should give some attention to the UnaryTypeTrait concept,
|
|
||||||
which requires the trait to be derived from either true_type or
|
|
||||||
false_type (as of the last LWG meeting). -->
|
|
||||||
<ol class="arabic" start="3">
|
|
||||||
<li><p class="first">Change <tt class="literal"><span class="pre">iterator_tag</span></tt> to:</p>
|
|
||||||
<pre class="literal-block">
|
|
||||||
template <class Value, class Reference, class Traversal>
|
|
||||||
struct iterator_tag;
|
|
||||||
</pre>
|
|
||||||
<p>The argument for <tt class="literal"><span class="pre">Value</span></tt> must be the <tt class="literal"><span class="pre">value_type</span></tt> of the
|
|
||||||
iterator, possibly const-qualified, <tt class="literal"><span class="pre">Reference</span></tt> must be the
|
|
||||||
return type of <tt class="literal"><span class="pre">operator*</span></tt> <a class="footnote-reference" href="#id2" id="id1" name="id1"><sup>*</sup></a>, and <tt class="literal"><span class="pre">Traversal</span></tt> the
|
|
||||||
traversal tag for the iterator.</p>
|
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
|
||||||
<!-- I think the language above is still too informal. There is no
|
|
||||||
"the iterator", when considering iterator_tag in isolation.
|
|
||||||
Perhaps that language belongs in a non-normative note
|
|
||||||
|
|
||||||
``iterator_tag<Value,Reference,Traversal>`` is required to be
|
|
||||||
convertible to both ``Traversal`` tag and also to the
|
|
||||||
``iterator_category`` type specified by the following
|
|
||||||
pseudo-code::
|
|
||||||
|
|
||||||
old-category(Value, Reference, Traversal) =
|
|
||||||
if (Reference is a reference
|
|
||||||
and Traversal is convertible to forward_traversal_tag)
|
|
||||||
{
|
|
||||||
if (Traversal is convertible to random_access_traversal_tag)
|
|
||||||
return random_access_iterator_tag;
|
|
||||||
else if (Traversal is convertible to bidirectional_traversal_tag)
|
|
||||||
return bidirectional_iterator_tag;
|
|
||||||
else
|
|
||||||
return forward_iterator_tag;
|
|
||||||
}
|
|
||||||
else if (Traversal is convertible to single_pass_traversal_tag
|
|
||||||
and Reference is convertible to Value)
|
|
||||||
{
|
|
||||||
if (Value is const)
|
|
||||||
return input_iterator_tag;
|
|
||||||
else
|
|
||||||
return input_output_iterator_tag;
|
|
||||||
} else
|
|
||||||
return output_iterator_tag; -->
|
|
||||||
<!-- I reformatted the code for legibility; sorry. -->
|
|
||||||
<table class="footnote" frame="void" id="id2" rules="none">
|
|
||||||
<colgroup><col class="label" /><col /></colgroup>
|
|
||||||
<tbody valign="top">
|
|
||||||
<tr><td class="label"><a class="fn-backref" href="#id1" name="id2">[*]</a></td><td>Instead of saying "return type of operator*", we could have
|
|
||||||
said <tt class="literal"><span class="pre">iterator_traits<X>::reference</span></tt>. However, the standard
|
|
||||||
specifies nothing about <tt class="literal"><span class="pre">iterator_traits<X>::reference</span></tt> in
|
|
||||||
many cases, which we believe is a defect. Furthermore, in some
|
|
||||||
cases it explicitly differs from the return type of
|
|
||||||
<tt class="literal"><span class="pre">operator*</span></tt>, for example see <tt class="literal"><span class="pre">istreambuf_iterator</span></tt>.</td></tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<ol class="arabic" start="4">
|
|
||||||
<li><p class="first">Change the specification of <tt class="literal"><span class="pre">traversal_category</span></tt> to:</p>
|
<li><p class="first">Change the specification of <tt class="literal"><span class="pre">traversal_category</span></tt> to:</p>
|
||||||
<pre class="literal-block">
|
<pre class="literal-block">
|
||||||
traversal-category(Iterator) =
|
traversal-category(Iterator) =
|
||||||
@ -366,7 +121,7 @@ traversal-category(Iterator) =
|
|||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="rationale">
|
<div class="section" id="rationale">
|
||||||
<h1><a class="toc-backref" href="#id5" name="rationale">Rationale</a></h1>
|
<h1><a class="toc-backref" href="#id3" name="rationale">Rationale</a></h1>
|
||||||
<ol class="arabic simple">
|
<ol class="arabic simple">
|
||||||
<li>There are two reasons for removing <tt class="literal"><span class="pre">is_writable</span></tt>
|
<li>There are two reasons for removing <tt class="literal"><span class="pre">is_writable</span></tt>
|
||||||
and <tt class="literal"><span class="pre">is_swappable</span></tt>. The first is that we do not know of
|
and <tt class="literal"><span class="pre">is_swappable</span></tt>. The first is that we do not know of
|
||||||
@ -387,32 +142,24 @@ using only the iterator type itself and its <tt class="literal"><span class="pre
|
|||||||
Therefore we remove the requirement for <tt class="literal"><span class="pre">is_readable</span></tt> from the
|
Therefore we remove the requirement for <tt class="literal"><span class="pre">is_readable</span></tt> from the
|
||||||
Readable Iterator concept, and change the definition of
|
Readable Iterator concept, and change the definition of
|
||||||
<tt class="literal"><span class="pre">is_readable</span></tt> so that it works for any iterator type.</li>
|
<tt class="literal"><span class="pre">is_readable</span></tt> so that it works for any iterator type.</li>
|
||||||
<li>With <tt class="literal"><span class="pre">is_writable</span></tt> and <tt class="literal"><span class="pre">is_swappable</span></tt> gone, and
|
<li>The purpose of the <tt class="literal"><span class="pre">iterator_tag</span></tt> class was to
|
||||||
|
bundle the traversal and access category tags
|
||||||
|
into the <tt class="literal"><span class="pre">iterator_category</span></tt> typedef.
|
||||||
|
With <tt class="literal"><span class="pre">is_writable</span></tt> and <tt class="literal"><span class="pre">is_swappable</span></tt> gone, and
|
||||||
<tt class="literal"><span class="pre">is_readable</span></tt> no longer in need of special hints,
|
<tt class="literal"><span class="pre">is_readable</span></tt> no longer in need of special hints,
|
||||||
there is no reason for the <tt class="literal"><span class="pre">iterator_tag</span></tt> class to provide
|
there is no reason for iterators to provide
|
||||||
information about the access capabilities of an iterator.
|
information about the access capabilities of an iterator.
|
||||||
This new version provides only information about the traversal
|
Thus there is no need for the <tt class="literal"><span class="pre">iterator_tag</span></tt>. The
|
||||||
capabilities and the old iterator category tag. Instead of accessing
|
traversal tag can be directly used for the
|
||||||
the traversal category as a nested typedef <tt class="literal"><span class="pre">::traversal</span></tt>,
|
<tt class="literal"><span class="pre">iterator_category</span></tt>. If a new iterator is intended to be backward
|
||||||
the <tt class="literal"><span class="pre">iterator_tag</span></tt> itself will be convertible to the traversal
|
compatible with old iterator concepts, a tag type
|
||||||
tag. The <tt class="literal"><span class="pre">access_bits</span></tt> parameter is no longer needed for
|
that is convertible to both one of the new traversal tags
|
||||||
specifying the access member (which is now gone). However,
|
and also to an old iterator tag can be created and use
|
||||||
some access information is still needed so that we can
|
for the <tt class="literal"><span class="pre">iterator_category</span></tt>.</li>
|
||||||
deduce the appropriate old iterator category. The
|
|
||||||
<tt class="literal"><span class="pre">Value</span></tt> and <tt class="literal"><span class="pre">Reference</span></tt> parameters fill this need.
|
|
||||||
Note that this solution cleans up the issue that John
|
|
||||||
Maddock raised on the reflector (<tt class="literal"><span class="pre">c++std-lib-12187</span></tt>) about the non-uniformity
|
|
||||||
of the lvalue bit.</li>
|
|
||||||
<li>The changes to the specification of <tt class="literal"><span class="pre">traversal_category</span></tt> are a
|
<li>The changes to the specification of <tt class="literal"><span class="pre">traversal_category</span></tt> are a
|
||||||
direct result of the changes to <tt class="literal"><span class="pre">iterator_tag</span></tt>.</li>
|
direct result of the removal of <tt class="literal"><span class="pre">iterator_tag</span></tt>.</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr class="footer" />
|
|
||||||
<div class="footer">
|
|
||||||
<a class="reference" href="issues.rst">View document source</a>.
|
|
||||||
Generated on: 2003-11-17 17:15 UTC.
|
|
||||||
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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Reference in New Issue
Block a user