mirror of
https://github.com/boostorg/iterator.git
synced 2025-07-29 04:17:32 +02:00
removed constraints on reference from Readable Iterator
[SVN r21641]
This commit is contained in:
@ -802,12 +802,14 @@ object. Is all this mechanism really necessary?
|
||||
c++std-lib-12333:
|
||||
|
||||
N1550 requires that for a Readable Iterator a of type X, ``*a`` returns an object of type
|
||||
iterator_traits<X>::reference. ``istreambuf_iterator::operator*`` returns charT, but
|
||||
istreambuf_iterator::reference is charT&. So am I overlooking something, or is
|
||||
istreambuf_iterator not Readable
|
||||
``iterator_traits<X>::reference``. ``istreambuf_iterator::operator*`` returns ``charT``, but
|
||||
``istreambuf_iterator::reference`` is ``charT&``. So am I overlooking something, or is
|
||||
``istreambuf_iterator`` not Readable.
|
||||
|
||||
:Proposed resolution: **Needs language** (Jeremy)
|
||||
Remove requirements on the reference type from Readable Iterator.
|
||||
:Proposed resolution:
|
||||
Remove all constraints on ``iterator_traits<X>::reference`` in Readable Iterator
|
||||
and Lvalue Iterator. Change Lvalue Iterator to refer to ``T&`` instead of
|
||||
``iterator_traits<X>::reference``.
|
||||
|
||||
|
||||
|
||||
|
@ -384,24 +384,12 @@ type <tt class="literal"><span class="pre">T</span></tt>.</p>
|
||||
<td>Any non-reference,
|
||||
non-cv-qualified type</td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">iterator_traits<X>::reference</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">R</span></tt>, Convertible to
|
||||
<tt class="literal"><span class="pre">T</span></tt></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">*a</span></tt></td>
|
||||
<td>Convertible to <tt class="literal"><span class="pre">R</span></tt>,
|
||||
Convertible to <tt class="literal"><span class="pre">T</span></tt></td>
|
||||
<td>Convertible to <tt class="literal"><span class="pre">T</span></tt></td>
|
||||
<td>pre: <tt class="literal"><span class="pre">a</span></tt> is
|
||||
dereferenceable. If <tt class="literal"><span class="pre">a</span>
|
||||
<span class="pre">==</span> <span class="pre">b</span></tt> then <tt class="literal"><span class="pre">*a</span></tt> is
|
||||
equivalent to <tt class="literal"><span class="pre">*b</span></tt></td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">static_cast<T>(</span>
|
||||
<span class="pre">static_cast<R>(*a)</span> <span class="pre">)</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">T</span></tt></td>
|
||||
<td>equivalent to
|
||||
<tt class="literal"><span class="pre">static_cast<T>(*a)</span></tt></td>
|
||||
equivalent to <tt class="literal"><span class="pre">*b</span></tt>.</td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">a->m</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">U&</span></tt></td>
|
||||
@ -411,10 +399,8 @@ to <tt class="literal"><span class="pre">(*a).m</span></tt></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- TR1: the originally-proposed requirement that typeof(*a) == R
|
||||
was too restrictive. Now we just require that it's
|
||||
convertible to R and that accessing a T through that conversion
|
||||
is equivalent to accessing a T directly. -->
|
||||
<!-- We won't say anything about iterator_traits<X>::reference until
|
||||
the DR is resolved. -->
|
||||
<a class="target" id="writable-iterator" name="writable-iterator"></a></div>
|
||||
<div class="section" id="writable-iterators-lib-writable-iterators">
|
||||
<h4><a class="toc-backref" href="#id12" name="writable-iterators-lib-writable-iterators">Writable Iterators [lib.writable.iterators]</a></h4>
|
||||
@ -480,8 +466,9 @@ exchanged</td>
|
||||
</div>
|
||||
<div class="section" id="lvalue-iterators-lib-lvalue-iterators">
|
||||
<h4><a class="toc-backref" href="#id14" name="lvalue-iterators-lib-lvalue-iterators">Lvalue Iterators [lib.lvalue.iterators]</a></h4>
|
||||
<p>The <em>Lvalue Iterator</em> concept adds the requirement that the
|
||||
<tt class="literal"><span class="pre">reference</span></tt> type be a reference to the value type of the iterator.</p>
|
||||
<p>The <em>Lvalue Iterator</em> concept adds the requirement that the return
|
||||
type of <tt class="literal"><span class="pre">operator*</span></tt> type be a reference to the value type of the
|
||||
iterator.</p>
|
||||
<table class="table" frame="border" rules="all">
|
||||
<colgroup>
|
||||
<col width="42%" />
|
||||
@ -493,16 +480,20 @@ exchanged</td>
|
||||
</tr>
|
||||
<tr><th>Expression</th>
|
||||
<th>Return Type</th>
|
||||
<th>Assertion</th>
|
||||
<th>Note/Assertion</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr><td><tt class="literal"><span class="pre">iterator_traits<X>::reference</span></tt></td>
|
||||
<tr><td><tt class="literal"><span class="pre">*a</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">T&</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">T</span></tt> is <em>cv</em>
|
||||
<tt class="literal"><span class="pre">iterator_traits<X>::value_type</span></tt>
|
||||
where <em>cv</em> is an optional
|
||||
cv-qualification</td>
|
||||
cv-qualification.
|
||||
pre: <tt class="literal"><span class="pre">a</span></tt> is
|
||||
dereferenceable. If <tt class="literal"><span class="pre">a</span>
|
||||
<span class="pre">==</span> <span class="pre">b</span></tt> then <tt class="literal"><span class="pre">*a</span></tt> is
|
||||
equivalent to <tt class="literal"><span class="pre">*b</span></tt>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -889,7 +880,7 @@ LocalWords: TraversalTag typename lvalues DWA Hmm JGS mis enum -->
|
||||
<hr class="footer"/>
|
||||
<div class="footer">
|
||||
<a class="reference" href="new-iter-concepts.rst">View document source</a>.
|
||||
Generated on: 2004-01-12 18:37 UTC.
|
||||
Generated on: 2004-01-12 19:53 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>
|
||||
|
@ -368,26 +368,18 @@ type ``T``.
|
||||
|``iterator_traits<X>::value_type`` |``T`` |Any non-reference, |
|
||||
| | |non-cv-qualified type |
|
||||
+-----------------------------------+------------------------+-------------------------+
|
||||
|``iterator_traits<X>::reference`` |``R``, Convertible to | |
|
||||
| |``T`` | |
|
||||
+-----------------------------------+------------------------+-------------------------+
|
||||
|``*a`` |Convertible to ``R``, |pre: ``a`` is |
|
||||
| |Convertible to ``T`` |dereferenceable. If ``a |
|
||||
|``*a`` | Convertible to ``T`` |pre: ``a`` is |
|
||||
| | |dereferenceable. If ``a |
|
||||
| | |== b`` then ``*a`` is |
|
||||
| | |equivalent to ``*b`` |
|
||||
+-----------------------------------+------------------------+-------------------------+
|
||||
|``static_cast<T>( |``T`` |equivalent to |
|
||||
|static_cast<R>(*a) )`` | |``static_cast<T>(*a)`` |
|
||||
| | |equivalent to ``*b``. |
|
||||
+-----------------------------------+------------------------+-------------------------+
|
||||
|``a->m`` |``U&`` |pre: ``(*a).m`` is |
|
||||
| | |well-defined. Equivalent|
|
||||
| | |to ``(*a).m`` |
|
||||
+-----------------------------------+------------------------+-------------------------+
|
||||
|
||||
.. TR1: the originally-proposed requirement that typeof(*a) == R
|
||||
was too restrictive. Now we just require that it's
|
||||
convertible to R and that accessing a T through that conversion
|
||||
is equivalent to accessing a T directly.
|
||||
.. We won't say anything about iterator_traits<X>::reference until
|
||||
the DR is resolved.
|
||||
|
||||
.. _Writable Iterator:
|
||||
|
||||
@ -432,21 +424,27 @@ expressions are valid and respect the stated semantics.
|
||||
Lvalue Iterators [lib.lvalue.iterators]
|
||||
---------------------------------------
|
||||
|
||||
The *Lvalue Iterator* concept adds the requirement that the
|
||||
``reference`` type be a reference to the value type of the iterator.
|
||||
The *Lvalue Iterator* concept adds the requirement that the return
|
||||
type of ``operator*`` type be a reference to the value type of the
|
||||
iterator.
|
||||
|
||||
+---------------------------------------------------------------------------------+
|
||||
| Lvalue Iterator Requirements |
|
||||
+---------------------------------+-----------+-----------------------------------+
|
||||
|Expression |Return Type|Assertion |
|
||||
|Expression |Return Type|Note/Assertion |
|
||||
+=================================+===========+===================================+
|
||||
|``iterator_traits<X>::reference``|``T&`` |``T`` is *cv* |
|
||||
|``*a`` | ``T&`` |``T`` is *cv* |
|
||||
| | |``iterator_traits<X>::value_type`` |
|
||||
| | |where *cv* is an optional |
|
||||
| | |cv-qualification |
|
||||
| | |cv-qualification. |
|
||||
| | |pre: ``a`` is |
|
||||
| | |dereferenceable. If ``a |
|
||||
| | |== b`` then ``*a`` is |
|
||||
| | |equivalent to ``*b``. |
|
||||
+---------------------------------+-----------+-----------------------------------+
|
||||
|
||||
|
||||
|
||||
Iterator Traversal Concepts [lib.iterator.traversal]
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
|
Reference in New Issue
Block a user