[SVN r21818]
This commit is contained in:
Jeremy Siek 2004-01-18 20:44:10 +00:00
parent 858e0e0c0b
commit 309f741588
3 changed files with 143 additions and 32 deletions

View File

@ -6,8 +6,8 @@
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
<title>Iterator Facade and Adaptor</title>
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
<meta name="date" content="2004-01-13" />
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, Zephyr Associates, Inc." />
<meta name="date" content="2004-01-18" />
<link rel="stylesheet" href="default.css" type="text/css" />
</head>
<body>
@ -20,13 +20,12 @@
<tr><th class="docinfo-name">Author:</th>
<td>David Abrahams, Jeremy Siek, Thomas Witt</td></tr>
<tr><th class="docinfo-name">Contact:</th>
<td><a class="first 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>, <a class="last reference" href="mailto:witt&#64;acm.org">witt&#64;acm.org</a></td></tr>
<td><a class="first 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>, <a class="last reference" href="mailto:witt&#64;styleadvisor.com">witt&#64;styleadvisor.com</a></td></tr>
<tr><th class="docinfo-name">Organization:</th>
<td><a class="first reference" href="http://www.boost-consulting.com">Boost Consulting</a>, Indiana University <a class="reference" href="http://www.osl.iu.edu">Open Systems
Lab</a>, University of Hanover <a class="last reference" href="http://www.ive.uni-hannover.de">Institute for Transport
Railway Operation and Construction</a></td></tr>
Lab</a>, <a class="last reference" href="http://www.styleadvisor.com">Zephyr Associates, Inc.</a></td></tr>
<tr><th class="docinfo-name">Date:</th>
<td>2004-01-13</td></tr>
<td>2004-01-18</td></tr>
<tr class="field"><th class="docinfo-name">Number:</th><td class="field-body">This is a revised version of <a class="reference" href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1530.html">N1530</a>=03-0113, which was
accepted for Technical Report 1 by the C++ standard
committee's library working group.</td>
@ -743,7 +742,7 @@ traversal tags would add no information]</p>
<!-- subject to the Boost Software License, Version 1.0. (See accompanying -->
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
<p>The <tt class="literal"><span class="pre">enable_if_interoperable</span></tt> template used above is for exposition
purposes. The member operators should be only be in an overload set
purposes. The member operators should only be in an overload set
provided the derived types <tt class="literal"><span class="pre">Dr1</span></tt> and <tt class="literal"><span class="pre">Dr2</span></tt> are interoperable,
meaning that at least one of the types is convertible to the other. The
<tt class="literal"><span class="pre">enable_if_interoperable</span></tt> approach uses SFINAE to take the operators
@ -1121,7 +1120,7 @@ operator -(iterator_facade&lt;Dr1,V1,TC1,R1,D1&gt; const&amp; lhs,
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">if <tt class="literal"><span class="pre">is_convertible&lt;Dr2,Dr1&gt;::value</span></tt>, then
<tt class="literal"><span class="pre">-lhs.distance_to(rhs)</span></tt>. Otherwise,
<tt class="literal"><span class="pre">-rhs.distance_to(lhs)</span></tt>.</td>
<tt class="literal"><span class="pre">rhs.distance_to(lhs)</span></tt>.</td>
</tr>
</tbody>
</table>

View File

@ -69,11 +69,11 @@ the following pseudo-code, where ``V`` is
typedef Difference difference_type;
if (CategoryOrTraversal is use_default)
typedef |iterator-category|_\ (
typedef *iterator-category* (
iterator_traversal<Iterator>::type,``reference``,``value_type``
) iterator_category;
else
typedef |iterator-category|_\ (
typedef *iterator-category* (
CategoryOrTraversal,``reference``,``value_type``
) iterator_category;

View File

@ -374,6 +374,49 @@ readability seems to introduce needless complexity.
else
return null_category_tag;
In [lib.iterator.special.adaptors]:
Change::
template <
class Iterator
, class Value = use_default
, unsigned Access = use_default_access
, class Traversal = use_default
, class Reference = use_default
, class Difference = use_default
>
class indirect_iterator
to::
template <
class Iterator
, class Value = use_default
, class CategoryOrTraversal = use_default
, class Reference = use_default
, class Difference = use_default
>
class indirect_iterator
Change::
template <
class Iterator2, class Value2, unsigned Access2, class Traversal2
, class Reference2, class Difference2
>
indirect_iterator(
to::
template <
class Iterator2, class Value2, class Category2
, class Reference2, class Difference2
>
indirect_iterator(
:Rationale:
1. There are two reasons for removing ``is_writable``
@ -705,29 +748,20 @@ Is that what's meant here?
constructor like this: the constructor returns "a copy" of the argument without saying what a
copy is.)
:Proposed resolution: Change the specification to
:Proposed resolution:
::
Change:
template <
class Iterator2, class Value2, unsigned Access, class Traversal
, class Reference2, class Difference2
>
indirect_iterator(
indirect_iterator<
Iterator2, Value2, Access, Traversal, Reference2, Difference2
> const& y
, typename enable_if_convertible<Iterator2, Iterator>::type* = 0 // exposition
);
:Returns: An instance of ``indirect_iterator`` that is a copy of ``y``.
:Requires: ``Iterator2`` is implicitly convertible to ``Iterator``.
:Returns: An instance of ``indirect_iterator`` whose
``m_iterator`` subobject is constructed from ``y.base()``.
to:
:Returns: An instance of ``indirect_iterator`` whose
``m_iterator`` subobject is constructed from ``y.base()``.
:Rationale: Inheritance from iterator_adaptor has been removed, so we
instead give the semantics in terms of the (exposition only) member
``m_iterator``.
instead give the semantics in terms of the member ``m_iterator``.
9.30 transform_iterator argument irregularity
@ -934,6 +968,84 @@ provide rather than how they're implemented.
In [lib.iterator.special.adaptors]
Change::
class indirect_iterator
: public iterator_adaptor</* see discussion */>
{
friend class iterator_core_access;
to::
class indirect_iterator
{
public:
typedef /* see below */ value_type;
typedef /* see below */ reference;
typedef /* see below */ pointer;
typedef /* see below */ difference_type;
typedef /* see below */ iterator_category;
Change::
private: // as-if specification
typename indirect_iterator::reference dereference() const
{
return **this->base();
}
to::
Iterator base() const;
reference operator*() const;
indirect_iterator& operator++();
indirect_iterator& operator--();
private:
Iterator m_iterator; // exposition
After the synopsis add:
The member types of ``indirect_iterator`` are defined according to
the following pseudo-code, where ``V`` is
``iterator_traits<Iterator>::value_type``
.. parsed-literal::
if (Value is use_default) then
typedef remove_const<pointee<V>::type>::type value_type;
else
typedef remove_const<Value>::type value_type;
if (Reference is use_default) then
if (Value is use_default) then
typedef indirect_reference<V>::type reference;
else
typedef Value& reference;
else
typedef Reference reference;
if (Value is use_default) then
typedef pointee<V>::type\* pointer;
else
typedef Value\* pointer;
if (Difference is use_default)
typedef iterator_traits<Iterator>::difference_type difference_type;
else
typedef Difference difference_type;
if (CategoryOrTraversal is use_default)
typedef |iterator-category|_\ (
iterator_traversal<Iterator>::type,``reference``,``value_type``
) iterator_category;
else
typedef |iterator-category|_\ (
CategoryOrTraversal,``reference``,``value_type``
) iterator_category;
Change::
@ -954,7 +1066,7 @@ provide rather than how they're implemented.
typedef /* see below */ iterator_category;
Add::
After ``UnaryFunction functor() const;`` add::
Iterator base() const;
reference operator*() const;
@ -976,7 +1088,7 @@ provide rather than how they're implemented.
};
Add:
After the synopsis, add:
If ``Iterator`` models Readable Lvalue Iterator and if ``Iterator``
models Random Access Traversal Iterator, then ``iterator_category`` is
@ -993,7 +1105,7 @@ provide rather than how they're implemented.
The type ``Iterator`` must at least model Readable Iterator. The
resulting ``transform_iterator`` models the most refined of the
following options that is also modeled by ``Iterator``.
following that is also modeled by ``Iterator``.
* Writable Lvalue Iterator if ``result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type`` is a non-const reference.
@ -1015,7 +1127,7 @@ provide rather than how they're implemented.
The argument ``Iterator`` shall model Readable Iterator.
Add a new models section:
Add a models section after the requirements section with the following contents:
The resulting ``transform_iterator`` models the most refined of the
following options that is also modeled by ``Iterator``.
@ -1059,7 +1171,7 @@ provide rather than how they're implemented.
:Returns: ``m_f(transform_iterator::dereference());``
Add::
After the entry for ``functor()``, add::
``Iterator base() const;``