forked from boostorg/iterator
This commit was manufactured by cvs2svn to create tag
'dwa-prelicense'. [SVN r35235]
This commit is contained in:
1 parent
3355660636
commit
2d32956cca
85 files changed
+348
-11239
No files matched your search
@@ -1,228 +0,0 @@
|
||||
Index: facade-and-adaptor.rst
|
||||
===================================================================
|
||||
RCS file: /cvsroot/boost/boost/libs/iterator/doc/facade-and-adaptor.rst,v
|
||||
retrieving revision 1.9
|
||||
retrieving revision 1.14
|
||||
diff -b -d -u -r1.9 -r1.14
|
||||
--- facade-and-adaptor.rst 22 Sep 2003 19:55:00 -0000 1.9
|
||||
+++ facade-and-adaptor.rst 18 Jan 2004 15:51:06 -0000 1.14
|
||||
@@ -3,17 +3,25 @@ None
|
||||
+++++++++++++++++++++++++++++
|
||||
|
||||
:Author: David Abrahams, Jeremy Siek, Thomas Witt
|
||||
-:Contact: dave@boost-consulting.com, jsiek@osl.iu.edu, witt@acm.org
|
||||
+:Contact: dave@boost-consulting.com, jsiek@osl.iu.edu, witt@styleadvisor.com
|
||||
:organization: `Boost Consulting`_, Indiana University `Open Systems
|
||||
- Lab`_, University of Hanover `Institute for Transport
|
||||
- Railway Operation and Construction`_
|
||||
-:date: $Date: 2004/01/18 19:56:39 $
|
||||
-:Number: N1530=03-0113
|
||||
+ Lab`_, `Zephyr Associates, Inc.`_
|
||||
+:date: $Date: 2004/01/18 19:56:39 $
|
||||
+
|
||||
+:Number: This is a revised version of N1530_\ =03-0113, which was
|
||||
+ accepted for Technical Report 1 by the C++ standard
|
||||
+ committee's library working group.
|
||||
+
|
||||
+.. Version 1.9 of this ReStructuredText document corresponds to
|
||||
+ n1530_, the paper accepted by the LWG.
|
||||
+
|
||||
+.. _n1530: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1530.html
|
||||
+
|
||||
:copyright: Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved
|
||||
|
||||
.. _`Boost Consulting`: http://www.boost-consulting.com
|
||||
.. _`Open Systems Lab`: http://www.osl.iu.edu
|
||||
-.. _`Institute for Transport Railway Operation and Construction`: http://www.ive.uni-hannover.de
|
||||
+.. _`Zephyr Associates, Inc.`: http://www.styleadvisor.com
|
||||
|
||||
:abstract: We propose a set of class templates that help programmers
|
||||
build standard-conforming iterators, both from scratch and
|
||||
@@ -124,15 +132,15 @@ None
|
||||
=================
|
||||
|
||||
This proposal is formulated in terms of the new ``iterator concepts``
|
||||
-as proposed in `n1477`_, since user-defined and especially adapted
|
||||
+as proposed in n1550_, since user-defined and especially adapted
|
||||
iterators suffer from the well known categorization problems that are
|
||||
inherent to the current iterator categories.
|
||||
|
||||
-.. _`n1477`: http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/papers/2003/n1477.html
|
||||
+.. _n1550: http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/papers/2003/n1550.html
|
||||
|
||||
-This proposal does not strictly depend on proposal `n1477`_, as there
|
||||
+This proposal does not strictly depend on proposal n1550_, as there
|
||||
is a direct mapping between new and old categories. This proposal
|
||||
-could be reformulated using this mapping if `n1477`_ was not accepted.
|
||||
+could be reformulated using this mapping if n1550_ was not accepted.
|
||||
|
||||
Interoperability
|
||||
================
|
||||
@@ -141,24 +149,24 @@ None
|
||||
current standard. There are currently two defect reports that are
|
||||
concerned with interoperability issues.
|
||||
|
||||
-Issue `179`_ concerns the fact that mutable container iterator types
|
||||
+Issue 179_ concerns the fact that mutable container iterator types
|
||||
are only required to be convertible to the corresponding constant
|
||||
iterator types, but objects of these types are not required to
|
||||
interoperate in comparison or subtraction expressions. This situation
|
||||
is tedious in practice and out of line with the way built in types
|
||||
work. This proposal implements the proposed resolution to issue
|
||||
-`179`_, as most standard library implementations do nowadays. In other
|
||||
+179_, as most standard library implementations do nowadays. In other
|
||||
words, if an iterator type A has an implicit or user defined
|
||||
conversion to an iterator type B, the iterator types are interoperable
|
||||
and the usual set of operators are available.
|
||||
|
||||
-Issue `280`_ concerns the current lack of interoperability between
|
||||
+Issue 280_ concerns the current lack of interoperability between
|
||||
reverse iterator types. The proposed new reverse_iterator template
|
||||
fixes the issues raised in 280. It provides the desired
|
||||
interoperability without introducing unwanted overloads.
|
||||
|
||||
-.. _`179`: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#179
|
||||
-.. _`280`: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#280
|
||||
+.. _179: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#179
|
||||
+.. _280: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#280
|
||||
|
||||
|
||||
Iterator Facade
|
||||
@@ -195,7 +203,7 @@ None
|
||||
* ``filter_iterator``, which provides a view of an iterator range in
|
||||
which some elements of the underlying range are skipped.
|
||||
|
||||
-.. _counting_iterator:
|
||||
+.. _counting:
|
||||
|
||||
* ``counting_iterator``, which adapts any incrementable type
|
||||
(e.g. integers, iterators) so that incrementing/decrementing the
|
||||
@@ -226,15 +234,13 @@ Issue 9.1 et al
|
||||
::
|
||||
|
||||
struct use_default;
|
||||
- const unsigned use_default_access = -1;
|
||||
|
||||
struct iterator_core_access { /* implementation detail */ };
|
||||
|
||||
template <
|
||||
class Derived
|
||||
, class Value
|
||||
- , unsigned AccessCategory
|
||||
- , class TraversalCategory
|
||||
+ , class CategoryOrTraversal
|
||||
, class Reference = Value&
|
||||
, class Difference = ptrdiff_t
|
||||
>
|
||||
@@ -244,8 +250,7 @@ Issue 9.1 et al.
|
||||
class Derived
|
||||
, class Base
|
||||
, class Value = use_default
|
||||
- , unsigned Access = use_default_access
|
||||
- , class Traversal = use_default
|
||||
+ , class CategoryOrTraversal = use_default
|
||||
, class Reference = use_default
|
||||
, class Difference = use_default
|
||||
>
|
||||
@@ -254,10 +259,9 @@ Issue 9.1 et al.
|
||||
template <
|
||||
class Iterator
|
||||
, class Value = use_default
|
||||
- , unsigned Access = use_default_access
|
||||
- , class Traversal = use_default
|
||||
+ , class CategoryOrTraversal = use_default
|
||||
, class Reference = use_default
|
||||
, class Difference = use_default
|
||||
>
|
||||
class indirect_iterator;
|
||||
|
||||
Issue 9.44y
|
||||
|
||||
+ template <class Dereferenceable>
|
||||
+ struct pointee;
|
||||
+
|
||||
+ template <class Dereferenceable>
|
||||
+ struct indirect_reference;
|
||||
+
|
||||
template <class Iterator>
|
||||
class reverse_iterator;
|
||||
|
||||
@@ -277,8 +287,7 @@ Issue 9.1 et al.
|
||||
|
||||
template <
|
||||
class Incrementable
|
||||
- , unsigned Access = use_default_access
|
||||
- , class Traversal = use_default
|
||||
+ , class CategoryOrTraversal = use_default
|
||||
, class Difference = use_default
|
||||
>
|
||||
class counting_iterator
|
||||
@@ -312,17 +321,35 @@ Issue 9.8
|
||||
Specialized adaptors [lib.iterator.special.adaptors]
|
||||
====================================================
|
||||
|
||||
-.. The requirements for all of these need to be written *much* more
|
||||
- formally -DWA
|
||||
-
|
||||
|
||||
-[*Note:* The ``enable_if_convertible<X,Y>::type`` expression used in
|
||||
+The ``enable_if_convertible<X,Y>::type`` expression used in
|
||||
this section is for exposition purposes. The converting constructors
|
||||
for specialized adaptors should be only be in an overload set provided
|
||||
that an object of type ``X`` is implicitly convertible to an object of
|
||||
-type ``Y``. The ``enable_if_convertible`` approach uses SFINAE to
|
||||
+type ``Y``.
|
||||
+The signatures involving ``enable_if_convertible`` should behave
|
||||
+*as-if* ``enable_if_convertible`` were defined to be::
|
||||
+
|
||||
+ template <bool> enable_if_convertible_impl
|
||||
+ {};
|
||||
+
|
||||
+ template <> enable_if_convertible_impl<true>
|
||||
+ { struct type; };
|
||||
+
|
||||
+ template<typename From, typename To>
|
||||
+ struct enable_if_convertible
|
||||
+ : enable_if_convertible_impl<is_convertible<From,To>::value>
|
||||
+ {};
|
||||
+
|
||||
+If an expression other than the default argument is used to supply
|
||||
+the value of a function parameter whose type is written in terms
|
||||
+of ``enable_if_convertible``, the program is ill-formed, no
|
||||
+diagnostic required.
|
||||
+
|
||||
+[*Note:* The ``enable_if_convertible`` approach uses SFINAE to
|
||||
take the constructor out of the overload set when the types are not
|
||||
-implicitly convertible.]
|
||||
+implicitly convertible.
|
||||
+]
|
||||
|
||||
|
||||
Indirect iterator
|
||||
@@ -330,6 +357,16 @@ Issue 9.44y
|
||||
|
||||
.. include:: indirect_iterator_abstract.rst
|
||||
|
||||
+Class template ``pointee``
|
||||
+....................................
|
||||
+
|
||||
+.. include:: pointee_ref.rst
|
||||
+
|
||||
+Class template ``indirect_reference``
|
||||
+.....................................
|
||||
+
|
||||
+.. include:: indirect_reference_ref.rst
|
||||
+
|
||||
Class template ``indirect_iterator``
|
||||
....................................
|
||||
|
||||
@@ -393,8 +430,7 @@
|
||||
|
||||
|
||||
|
||||
-..
|
||||
- LocalWords: Abrahams Siek Witt istream ostream iter MTL strided interoperate
|
||||
+.. LocalWords: Abrahams Siek Witt istream ostream iter MTL strided interoperate
|
||||
LocalWords: CRTP metafunctions inlining lvalue JGS incrementable BGL LEDA cv
|
||||
LocalWords: GraphBase struct ptrdiff UnaryFunction const int typename bool pp
|
||||
LocalWords: lhs rhs SFINAE markup iff tmp OtherDerived OtherIterator DWA foo
|
||||
@@ -1,245 +0,0 @@
|
||||
Index: indirect_iterator_ref.rst
|
||||
===================================================================
|
||||
RCS file: /cvsroot/boost/boost/libs/iterator/doc/indirect_iterator_ref.rst,v
|
||||
retrieving revision 1.2
|
||||
retrieving revision 1.21
|
||||
diff -w -d -u -b -r1.2 -r1.21
|
||||
--- indirect_iterator_ref.rst 22 Sep 2003 19:55:00 -0000 1.2
|
||||
+++ indirect_iterator_ref.rst 15 Jan 2004 00:01:33 -0000 1.21
|
||||
|
||||
|
||||
|
||||
@@ -3,82 +3,139 @@
|
||||
template <
|
||||
class Iterator
|
||||
, class Value = use_default
|
||||
|
||||
Issue 9.15
|
||||
|
||||
- , unsigned Access = use_default_access
|
||||
- , class Traversal = use_default
|
||||
+ , class CategoryOrTraversal = use_default
|
||||
, class Reference = use_default
|
||||
, class Difference = use_default
|
||||
>
|
||||
class indirect_iterator
|
||||
|
||||
Issue 9.37x
|
||||
|
||||
- : public iterator_adaptor</* see discussion */>
|
||||
{
|
||||
- friend class iterator_core_access;
|
||||
public:
|
||||
+ typedef /* see below */ value_type;
|
||||
+ typedef /* see below */ reference;
|
||||
+ typedef /* see below */ pointer;
|
||||
+ typedef /* see below */ difference_type;
|
||||
+ typedef /* see below */ iterator_category;
|
||||
+
|
||||
indirect_iterator();
|
||||
indirect_iterator(Iterator x);
|
||||
+
|
||||
|
||||
Issue 9.15
|
||||
|
||||
template <
|
||||
- class Iterator2, class Value2, unsigned Access2, class Traversal2
|
||||
+ class Iterator2, class Value2, class Category2
|
||||
, class Reference2, class Difference2
|
||||
>
|
||||
indirect_iterator(
|
||||
indirect_iterator<
|
||||
- Iterator2, Value2, Access2, Traversal2, Reference2, Difference2
|
||||
+ Iterator2, Value2, Category2, Reference2, Difference2
|
||||
> const& y
|
||||
, typename enable_if_convertible<Iterator2, Iterator>::type* = 0 // exposition
|
||||
);
|
||||
|
||||
Issue 9.37x
|
||||
|
||||
- private: // as-if specification
|
||||
- typename indirect_iterator::reference dereference() const
|
||||
- {
|
||||
- return **this->base();
|
||||
- }
|
||||
+
|
||||
+ Iterator const& base() const;
|
||||
+ reference operator*() const;
|
||||
+ indirect_iterator& operator++();
|
||||
+ indirect_iterator& operator--();
|
||||
+ private:
|
||||
+ Iterator m_iterator; // exposition
|
||||
};
|
||||
|
||||
+
|
||||
+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;
|
||||
+
|
||||
+
|
||||
|
||||
``indirect_iterator`` requirements
|
||||
..................................
|
||||
|
||||
Issue 9.40x
|
||||
|
||||
-The ``value_type`` of the ``Iterator`` template parameter should
|
||||
-itself be dereferenceable. The return type of the ``operator*`` for
|
||||
-the ``value_type`` must be the same type as the ``Reference`` template
|
||||
-parameter. The ``Value`` template parameter will be the ``value_type``
|
||||
-for the ``indirect_iterator``, unless ``Value`` is const. If ``Value``
|
||||
-is ``const X``, then ``value_type`` will be *non-* ``const X``. The
|
||||
-default for ``Value`` is
|
||||
+The expression ``*v``, where ``v`` is an object of
|
||||
+``iterator_traits<Iterator>::value_type``, shall be valid
|
||||
+expression and convertible to ``reference``. ``Iterator`` shall
|
||||
+model the traversal concept indicated by ``iterator_category``.
|
||||
+``Value``, ``Reference``, and ``Difference`` shall be chosen so
|
||||
+that ``value_type``, ``reference``, and ``difference_type`` meet
|
||||
+the requirements indicated by ``iterator_category``.
|
||||
|
||||
-::
|
||||
+[Note: there are further requirements on the
|
||||
+``iterator_traits<Iterator>::value_type`` if the ``Value``
|
||||
+parameter is not ``use_default``, as implied by the algorithm for
|
||||
+deducing the default for the ``value_type`` member.]
|
||||
|
||||
- iterator_traits< iterator_traits<Iterator>::value_type >::value_type
|
||||
|
||||
Issue 9.37x
|
||||
|
||||
+``indirect_iterator`` models
|
||||
+............................
|
||||
|
||||
-If the default is used for ``Value``, then there must be a valid
|
||||
-specialization of ``iterator_traits`` for the value type of the base
|
||||
-iterator.
|
||||
+In addition to the concepts indicated by ``iterator_category``
|
||||
+and by ``iterator_traversal<indirect_iterator>::type``, a
|
||||
+specialization of ``indirect_iterator`` models the following
|
||||
+concepts, Where ``v`` is an object of
|
||||
+``iterator_traits<Iterator>::value_type``:
|
||||
|
||||
-The ``Reference`` parameter will be the ``reference`` type of the
|
||||
-``indirect_iterator``. The default is ``Value&``.
|
||||
+ * Readable Iterator if ``reference(*v)`` is convertible to
|
||||
+ ``value_type``.
|
||||
|
||||
-The ``Access`` and ``Traversal`` parameters are passed unchanged to
|
||||
-the corresponding parameters of the ``iterator_adaptor`` base
|
||||
-class, and the ``Iterator`` parameter is passed unchanged as the
|
||||
-``Base`` parameter to the ``iterator_adaptor`` base class.
|
||||
+ * Writable Iterator if ``reference(*v) = t`` is a valid
|
||||
+ expression (where ``t`` is an object of type
|
||||
+ ``indirect_iterator::value_type``)
|
||||
|
||||
-The indirect iterator will model the most refined standard traversal
|
||||
-concept that is modeled by the ``Iterator`` type. The indirect
|
||||
-iterator will model the most refined standard access concept that is
|
||||
-modeled by the value type of ``Iterator``.
|
||||
+ * Lvalue Iterator if ``reference`` is a reference type.
|
||||
+
|
||||
+``indirect_iterator<X,V1,C1,R1,D1>`` is interoperable with
|
||||
+``indirect_iterator<Y,V2,C2,R2,D2>`` if and only if ``X`` is
|
||||
+interoperable with ``Y``.
|
||||
|
||||
|
||||
``indirect_iterator`` operations
|
||||
................................
|
||||
|
||||
Issue 9.37x
|
||||
|
||||
+In addition to the operations required by the concepts described
|
||||
+above, specializations of ``indirect_iterator`` provide the
|
||||
+following operations.
|
||||
+
|
||||
+
|
||||
|
||||
Issue 9.28 and 9.37x
|
||||
|
||||
``indirect_iterator();``
|
||||
|
||||
:Requires: ``Iterator`` must be Default Constructible.
|
||||
:Returns: An instance of ``indirect_iterator`` with
|
||||
- a default constructed base object.
|
||||
+ a default-constructed ``m_iterator``.
|
||||
|
||||
|
||||
Issue 9.37x
|
||||
|
||||
``indirect_iterator(Iterator x);``
|
||||
|
||||
:Returns: An instance of ``indirect_iterator`` with
|
||||
- the ``iterator_adaptor`` subobject copy constructed from ``x``.
|
||||
+ ``m_iterator`` copy constructed from ``x``.
|
||||
|
||||
::
|
||||
|
||||
|
||||
Issue 9.29
|
||||
|
||||
@@ -94,5 +151,27 @@
|
||||
);
|
||||
|
||||
:Requires: ``Iterator2`` is implicitly convertible to ``Iterator``.
|
||||
-:Returns: An instance of ``indirect_iterator`` that is a copy of ``y``.
|
||||
+:Returns: An instance of ``indirect_iterator`` whose
|
||||
+ ``m_iterator`` subobject is constructed from ``y.base()``.
|
||||
+
|
||||
|
||||
Issue 9.37x
|
||||
|
||||
+``Iterator const& base() const;``
|
||||
|
||||
+:Returns: ``m_iterator``
|
||||
+
|
||||
+
|
||||
+``reference operator*() const;``
|
||||
+
|
||||
+:Returns: ``**m_iterator``
|
||||
+
|
||||
+
|
||||
+``indirect_iterator& operator++();``
|
||||
+
|
||||
+:Effects: ``++m_iterator``
|
||||
+:Returns: ``*this``
|
||||
+
|
||||
+
|
||||
+``indirect_iterator& operator--();``
|
||||
+
|
||||
+:Effects: ``--m_iterator``
|
||||
+:Returns: ``*this``
|
||||
+348
-67
@@ -3,68 +3,354 @@
|
||||
<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/" />
|
||||
<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
|
||||
<title>Problem with is_writable and is_swappable in N1550</title>
|
||||
<link rel="stylesheet" href="default.css" type="text/css" />
|
||||
<meta name="author" content="David Abrahams and Jeremy Siek" />
|
||||
<meta name="organization" content="Boost Consulting, Indiana University Bloomington" />
|
||||
<meta name="date" content="2003-11-19" />
|
||||
<meta name="copyright" content="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 http://www.boost.org/LICENSE_1_0.txt)" />
|
||||
<style type="text/css">
|
||||
|
||||
/*
|
||||
:Author: David Goodger
|
||||
:Contact: goodger@users.sourceforge.net
|
||||
:Date: $Date$
|
||||
:Revision: $Revision$
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
|
||||
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
|
||||
/* used to remove borders from tables and images */
|
||||
.borderless, table.borderless td, table.borderless th {
|
||||
border: 0 }
|
||||
|
||||
table.borderless td, table.borderless th {
|
||||
/* Override padding for "table.docutils td" with "! important".
|
||||
The right padding separates the table cells. */
|
||||
padding: 0 0.5em 0 0 ! important }
|
||||
|
||||
.first {
|
||||
/* Override more specific margin styles with "! important". */
|
||||
margin-top: 0 ! important }
|
||||
|
||||
.last, .with-subtitle {
|
||||
margin-bottom: 0 ! important }
|
||||
|
||||
.hidden {
|
||||
display: none }
|
||||
|
||||
a.toc-backref {
|
||||
text-decoration: none ;
|
||||
color: black }
|
||||
|
||||
blockquote.epigraph {
|
||||
margin: 2em 5em ; }
|
||||
|
||||
dl.docutils dd {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
/* Uncomment (and remove this text!) to get bold-faced definition list terms
|
||||
dl.docutils dt {
|
||||
font-weight: bold }
|
||||
*/
|
||||
|
||||
div.abstract {
|
||||
margin: 2em 5em }
|
||||
|
||||
div.abstract p.topic-title {
|
||||
font-weight: bold ;
|
||||
text-align: center }
|
||||
|
||||
div.admonition, 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.admonition p.admonition-title, 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.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 }
|
||||
|
||||
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||
compound paragraphs.
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
*/
|
||||
|
||||
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 ;
|
||||
margin-right: 2em }
|
||||
|
||||
div.footer, div.header {
|
||||
clear: both;
|
||||
font-size: smaller }
|
||||
|
||||
div.line-block {
|
||||
display: block ;
|
||||
margin-top: 1em ;
|
||||
margin-bottom: 1em }
|
||||
|
||||
div.line-block div.line-block {
|
||||
margin-top: 0 ;
|
||||
margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
|
||||
div.sidebar {
|
||||
margin-left: 1em ;
|
||||
border: medium outset ;
|
||||
padding: 1em ;
|
||||
background-color: #ffffee ;
|
||||
width: 40% ;
|
||||
float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric {
|
||||
font-family: sans-serif ;
|
||||
font-size: medium }
|
||||
|
||||
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.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||
margin-top: 0.4em }
|
||||
|
||||
h1.title {
|
||||
text-align: center }
|
||||
|
||||
h2.subtitle {
|
||||
text-align: center }
|
||||
|
||||
hr.docutils {
|
||||
width: 75% }
|
||||
|
||||
img.align-left {
|
||||
clear: left }
|
||||
|
||||
img.align-right {
|
||||
clear: right }
|
||||
|
||||
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.attribution {
|
||||
text-align: right ;
|
||||
margin-left: 50% }
|
||||
|
||||
p.caption {
|
||||
font-style: italic }
|
||||
|
||||
p.credits {
|
||||
font-style: italic ;
|
||||
font-size: smaller }
|
||||
|
||||
p.label {
|
||||
white-space: nowrap }
|
||||
|
||||
p.rubric {
|
||||
font-weight: bold ;
|
||||
font-size: larger ;
|
||||
color: maroon ;
|
||||
text-align: center }
|
||||
|
||||
p.sidebar-title {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold ;
|
||||
font-size: larger }
|
||||
|
||||
p.sidebar-subtitle {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
p.topic-title {
|
||||
font-weight: bold }
|
||||
|
||||
pre.address {
|
||||
margin-bottom: 0 ;
|
||||
margin-top: 0 ;
|
||||
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 {
|
||||
white-space: nowrap }
|
||||
|
||||
span.pre {
|
||||
white-space: pre }
|
||||
|
||||
span.problematic {
|
||||
color: red }
|
||||
|
||||
span.section-subtitle {
|
||||
/* font-size relative to parent (h1..h6 element) */
|
||||
font-size: 80% }
|
||||
|
||||
table.citation {
|
||||
border-left: solid 1px gray;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docinfo {
|
||||
margin: 2em 4em }
|
||||
|
||||
table.docutils {
|
||||
margin-top: 0.5em ;
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
table.footnote {
|
||||
border-left: solid 1px black;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docutils td, table.docutils th,
|
||||
table.docinfo td, table.docinfo th {
|
||||
padding-left: 0.5em ;
|
||||
padding-right: 0.5em ;
|
||||
vertical-align: top }
|
||||
|
||||
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||
font-weight: bold ;
|
||||
text-align: left ;
|
||||
white-space: nowrap ;
|
||||
padding-left: 0 }
|
||||
|
||||
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
||||
font-size: 100% }
|
||||
|
||||
tt.docutils {
|
||||
background-color: #eeeeee }
|
||||
|
||||
ul.auto-toc {
|
||||
list-style-type: none }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="title">Problem with <tt class="literal"><span class="pre">is_writable</span></tt> and <tt class="literal"><span class="pre">is_swappable</span></tt> in <a class="reference" href="http://www.boost-consulting.com/writing/n1550.html">N1550</a></h1>
|
||||
<div class="document" id="problem-with-is-writable-and-is-swappable-in-n1550">
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<h1 class="title">Problem with <tt class="docutils literal"><span class="pre">is_writable</span></tt> and <tt class="docutils literal"><span class="pre">is_swappable</span></tt> in <a class="reference" href="http://www.boost-consulting.com/writing/n1550.html">N1550</a></h1>
|
||||
<table class="docinfo" frame="void" rules="none">
|
||||
<col class="docinfo-name" />
|
||||
<col class="docinfo-content" />
|
||||
<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
|
||||
<tr><th class="docinfo-name">Author:</th>
|
||||
<td>David Abrahams and Jeremy Siek</td></tr>
|
||||
<tr><th class="docinfo-name">Contact:</th>
|
||||
<td><a class="first reference" href="mailto:dave@boost-consulting.com">dave@boost-consulting.com</a>, <a class="last reference" href="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</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 Bloomington</td></tr>
|
||||
<tr><th class="docinfo-name">Date:</th>
|
||||
<td>2003-11-19</td></tr>
|
||||
<tr><th class="docinfo-name">Copyright:</th>
|
||||
<td>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>
|
||||
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="contents topic" id="table-of-contents">
|
||||
<p class="topic-title first"><a name="table-of-contents">Table of Contents</a></p>
|
||||
<div class="contents topic">
|
||||
<p class="topic-title first"><a id="table-of-contents" name="table-of-contents">Table of Contents</a></p>
|
||||
<ul class="simple">
|
||||
<li><a class="reference" href="#introduction" id="id1" name="id1">Introduction</a></li>
|
||||
<li><a class="reference" href="#proposed-resolution" id="id2" name="id2">Proposed Resolution</a></li>
|
||||
<li><a class="reference" href="#rationale" id="id3" name="id3">Rationale</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="introduction">
|
||||
<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>
|
||||
<div class="section">
|
||||
<h1><a class="toc-backref" href="#id1" id="introduction" name="introduction">Introduction</a></h1>
|
||||
<p>The <tt class="docutils literal"><span class="pre">is_writable</span></tt> and <tt class="docutils 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
|
||||
type is a model of the new Writable Iterator and Swappable Iterator
|
||||
concepts, analogous to <tt class="literal"><span class="pre">iterator_traits<X>::iterator_category</span></tt>
|
||||
concepts, analogous to <tt class="docutils literal"><span class="pre">iterator_traits<X>::iterator_category</span></tt>
|
||||
for the old iterator concepts. For backward compatibility,
|
||||
<tt class="literal"><span class="pre">is_writable</span></tt> and <tt class="literal"><span class="pre">is_swappable</span></tt> not only work with new
|
||||
<tt class="docutils literal"><span class="pre">is_writable</span></tt> and <tt class="docutils literal"><span class="pre">is_swappable</span></tt> not only work with new
|
||||
iterators, but they also are intended to work for old
|
||||
iterators (iterators that meet the requirements for one of the
|
||||
iterator concepts in the current standard). In the case of old
|
||||
iterators, the writability and swapability is deduced based on the
|
||||
<tt class="literal"><span class="pre">iterator_category</span></tt> and also the <tt class="literal"><span class="pre">reference</span></tt> type. The
|
||||
<tt class="docutils literal"><span class="pre">iterator_category</span></tt> and also the <tt class="docutils literal"><span class="pre">reference</span></tt> type. The
|
||||
specification for this deduction gives false positives for forward
|
||||
iterators that have non-assignable value types.</p>
|
||||
<p>To review, the part of the <tt class="literal"><span class="pre">is_writable</span></tt> trait definition which
|
||||
<p>To review, the part of the <tt class="docutils literal"><span class="pre">is_writable</span></tt> trait definition which
|
||||
applies to old iterators is:</p>
|
||||
<pre class="literal-block">
|
||||
if (cat is convertible to output_iterator_tag)
|
||||
return true;
|
||||
else if (cat is convertible to forward_iterator_tag
|
||||
and iterator_traits<Iterator>::reference is a
|
||||
and iterator_traits<Iterator>::reference is a
|
||||
mutable reference)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
</pre>
|
||||
<p>Suppose the <tt class="literal"><span class="pre">value_type</span></tt> of the iterator <tt class="literal"><span class="pre">It</span></tt> has a private
|
||||
<p>Suppose the <tt class="docutils literal"><span class="pre">value_type</span></tt> of the iterator <tt class="docutils literal"><span class="pre">It</span></tt> has a private
|
||||
assignment operator:</p>
|
||||
<pre class="literal-block">
|
||||
class B {
|
||||
@@ -74,31 +360,31 @@ private:
|
||||
B& operator=(const B&);
|
||||
};
|
||||
</pre>
|
||||
<p>and suppose the <tt class="literal"><span class="pre">reference</span></tt> type of the iterator is <tt class="literal"><span class="pre">B&</span></tt>. In
|
||||
that case, <tt class="literal"><span class="pre">is_writable<It>::value</span></tt> will be true when in fact
|
||||
attempting to write into <tt class="literal"><span class="pre">B</span></tt> will cause an error.</p>
|
||||
<p>The same problem applies to <tt class="literal"><span class="pre">is_swappable</span></tt>.</p>
|
||||
<p>and suppose the <tt class="docutils literal"><span class="pre">reference</span></tt> type of the iterator is <tt class="docutils literal"><span class="pre">B&</span></tt>. In
|
||||
that case, <tt class="docutils literal"><span class="pre">is_writable<It>::value</span></tt> will be true when in fact
|
||||
attempting to write into <tt class="docutils literal"><span class="pre">B</span></tt> will cause an error.</p>
|
||||
<p>The same problem applies to <tt class="docutils literal"><span class="pre">is_swappable</span></tt>.</p>
|
||||
</div>
|
||||
<div class="section" id="proposed-resolution">
|
||||
<h1><a class="toc-backref" href="#id2" name="proposed-resolution">Proposed Resolution</a></h1>
|
||||
<div class="section">
|
||||
<h1><a class="toc-backref" href="#id2" id="proposed-resolution" name="proposed-resolution">Proposed Resolution</a></h1>
|
||||
<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="docutils literal"><span class="pre">is_writable</span></tt> and <tt class="docutils literal"><span class="pre">is_swappable</span></tt> traits, and remove the
|
||||
requirements in the Writable Iterator and Swappable Iterator concepts
|
||||
that require their models to support these traits.</p>
|
||||
</li>
|
||||
<li><p class="first">Change the <tt class="literal"><span class="pre">is_readable</span></tt> specification to be:
|
||||
<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
|
||||
<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. Also, <tt class="literal"><span class="pre">is_readable</span></tt> is required to satisfy
|
||||
<li><p class="first">Change the <tt class="docutils literal"><span class="pre">is_readable</span></tt> specification to be:
|
||||
<tt class="docutils literal"><span class="pre">is_readable<X>::type</span></tt> is <tt class="docutils literal"><span class="pre">true_type</span></tt> if the
|
||||
result type of <tt class="docutils literal"><span class="pre">X::operator*</span></tt> is convertible to
|
||||
<tt class="docutils literal"><span class="pre">iterator_traits<X>::value_type</span></tt> and is <tt class="docutils literal"><span class="pre">false_type</span></tt>
|
||||
otherwise. Also, <tt class="docutils 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="docutils literal"><span class="pre">is_readable</span></tt> trait from
|
||||
the Readable Iterator concept.</p>
|
||||
</li>
|
||||
<li><p class="first">Remove the <tt class="literal"><span class="pre">iterator_tag</span></tt> class.</p>
|
||||
<li><p class="first">Remove the <tt class="docutils literal"><span class="pre">iterator_tag</span></tt> class.</p>
|
||||
</li>
|
||||
<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="docutils literal"><span class="pre">traversal_category</span></tt> to:</p>
|
||||
<pre class="literal-block">
|
||||
traversal-category(Iterator) =
|
||||
let cat = iterator_traits<Iterator>::iterator_category
|
||||
@@ -120,14 +406,14 @@ traversal-category(Iterator) =
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="section" id="rationale">
|
||||
<h1><a class="toc-backref" href="#id3" name="rationale">Rationale</a></h1>
|
||||
<div class="section">
|
||||
<h1><a class="toc-backref" href="#id3" id="rationale" name="rationale">Rationale</a></h1>
|
||||
<ol class="arabic simple">
|
||||
<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
|
||||
<li>There are two reasons for removing <tt class="docutils literal"><span class="pre">is_writable</span></tt>
|
||||
and <tt class="docutils literal"><span class="pre">is_swappable</span></tt>. The first is that we do not know of
|
||||
a way to fix the specification so that it gives the correct
|
||||
answer for all iterators. Second, there was only a weak
|
||||
motivation for having <tt class="literal"><span class="pre">is_writable</span></tt> and <tt class="literal"><span class="pre">is_swappable</span></tt>
|
||||
motivation for having <tt class="docutils literal"><span class="pre">is_writable</span></tt> and <tt class="docutils literal"><span class="pre">is_swappable</span></tt>
|
||||
there in the first place. The main motivation was simply
|
||||
uniformity: we have tags for the old iterator categories
|
||||
so we should have tags for the new iterator categories.
|
||||
@@ -137,34 +423,29 @@ less of a need for dispatching based on writability
|
||||
and swappability, since typically algorithms
|
||||
that need these capabilities have no alternative if
|
||||
they are not provided.</li>
|
||||
<li>We discovered that the <tt class="literal"><span class="pre">is_readable</span></tt> trait can be implemented
|
||||
using only the iterator type itself and its <tt class="literal"><span class="pre">value_type</span></tt>.
|
||||
Therefore we remove the requirement for <tt class="literal"><span class="pre">is_readable</span></tt> from the
|
||||
<li>We discovered that the <tt class="docutils literal"><span class="pre">is_readable</span></tt> trait can be implemented
|
||||
using only the iterator type itself and its <tt class="docutils literal"><span class="pre">value_type</span></tt>.
|
||||
Therefore we remove the requirement for <tt class="docutils literal"><span class="pre">is_readable</span></tt> from the
|
||||
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>
|
||||
<li>The purpose of the <tt class="literal"><span class="pre">iterator_tag</span></tt> class was to
|
||||
<tt class="docutils literal"><span class="pre">is_readable</span></tt> so that it works for any iterator type.</li>
|
||||
<li>The purpose of the <tt class="docutils 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,
|
||||
into the <tt class="docutils literal"><span class="pre">iterator_category</span></tt> typedef.
|
||||
With <tt class="docutils literal"><span class="pre">is_writable</span></tt> and <tt class="docutils literal"><span class="pre">is_swappable</span></tt> gone, and
|
||||
<tt class="docutils literal"><span class="pre">is_readable</span></tt> no longer in need of special hints,
|
||||
there is no reason for iterators to provide
|
||||
information about the access capabilities of an iterator.
|
||||
Thus there is no need for the <tt class="literal"><span class="pre">iterator_tag</span></tt>. The
|
||||
Thus there is no need for the <tt class="docutils literal"><span class="pre">iterator_tag</span></tt>. The
|
||||
traversal tag can be directly used for the
|
||||
<tt class="literal"><span class="pre">iterator_category</span></tt>. If a new iterator is intended to be backward
|
||||
<tt class="docutils literal"><span class="pre">iterator_category</span></tt>. If a new iterator is intended to be backward
|
||||
compatible with old iterator concepts, a tag type
|
||||
that is convertible to both one of the new traversal tags
|
||||
that is convertible to both one of the new traversal tags
|
||||
and also to an old iterator tag can be created and use
|
||||
for the <tt class="literal"><span class="pre">iterator_category</span></tt>.</li>
|
||||
<li>The changes to the specification of <tt class="literal"><span class="pre">traversal_category</span></tt> are a
|
||||
direct result of the removal of <tt class="literal"><span class="pre">iterator_tag</span></tt>.</li>
|
||||
for the <tt class="docutils literal"><span class="pre">iterator_category</span></tt>.</li>
|
||||
<li>The changes to the specification of <tt class="docutils literal"><span class="pre">traversal_category</span></tt> are a
|
||||
direct result of the removal of <tt class="docutils literal"><span class="pre">iterator_tag</span></tt>.</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="footer" />
|
||||
<div class="footer">
|
||||
<a class="reference" href="issues.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>
|
||||
@@ -1,22 +0,0 @@
|
||||
Index: iterator_adaptor_abstract.rst
|
||||
===================================================================
|
||||
RCS file: /cvsroot/boost/boost/libs/iterator/doc/iterator_adaptor_abstract.rst,v
|
||||
retrieving revision 1.1
|
||||
retrieving revision 1.2
|
||||
diff -b -d -u -r1.1 -r1.2
|
||||
--- iterator_adaptor_abstract.rst 5 Aug 2003 18:19:55 -0000 1.1
|
||||
+++ iterator_adaptor_abstract.rst 24 Nov 2003 05:02:46 -0000 1.2
|
||||
@@ -1,5 +1,11 @@ Issue 9.21
|
||||
-The ``iterator_adaptor`` is a base class template derived from an
|
||||
-instantiation of ``iterator_facade``. The core interface functions
|
||||
+.. Version 1.1 of this ReStructuredText document corresponds to
|
||||
+ n1530_, the paper accepted by the LWG.
|
||||
+
|
||||
+.. Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All
|
||||
+ rights reserved
|
||||
+
|
||||
+Each specialization of the ``iterator_adaptor`` class template is derived from
|
||||
+a specialization of ``iterator_facade``. The core interface functions
|
||||
expected by ``iterator_facade`` are implemented in terms of the
|
||||
``iterator_adaptor``\ 's ``Base`` template parameter. A class derived
|
||||
from ``iterator_adaptor`` typically redefines some of the core
|
||||
@@ -1,35 +0,0 @@
|
||||
Index: iterator_adaptor_body.rst
|
||||
===================================================================
|
||||
RCS file: /cvsroot/boost/boost/libs/iterator/doc/iterator_adaptor_body.rst,v
|
||||
retrieving revision 1.2
|
||||
retrieving revision 1.3
|
||||
diff -b -d -u -r1.2 -r1.3
|
||||
--- iterator_adaptor_body.rst 22 Sep 2003 19:55:00 -0000 1.2
|
||||
+++ iterator_adaptor_body.rst 24 Nov 2003 05:02:46 -0000 1.3
|
||||
@@ -1,3 +1,9 @@
|
||||
+.. Version 1.2 of this ReStructuredText document corresponds to
|
||||
+ n1530_, the paper accepted by the LWG for TR1.
|
||||
+
|
||||
+.. Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All
|
||||
+ rights reserved
|
||||
+
|
||||
The ``iterator_adaptor`` class template adapts some ``Base`` [#base]_
|
||||
type to create a new iterator. Instantiations of ``iterator_adaptor``
|
||||
are derived from a corresponding instantiation of ``iterator_facade``
|
||||
@@ -19,7 +25,7 @@ Issue 9.1 et al
|
||||
redefined in the user's derived class.
|
||||
|
||||
Several of the template parameters of ``iterator_adaptor`` default
|
||||
-to ``use_default`` (or ``use_default_access``). This allows the
|
||||
+to ``use_default``. This allows the
|
||||
user to make use of a default parameter even when she wants to
|
||||
specify a parameter later in the parameter list. Also, the
|
||||
defaults for the corresponding associated types are somewhat
|
||||
@@ -28,6 +34,6 @@ Issue 9.45y
|
||||
the identity of the ``use_default`` type is not left unspecified
|
||||
because specification helps to highlight that the ``Reference``
|
||||
template parameter may not always be identical to the iterator's
|
||||
-``reference`` type, and will keep users making mistakes based on
|
||||
+``reference`` type, and will keep users from making mistakes based on
|
||||
that assumption.
|
||||
|
||||
@@ -1,202 +0,0 @@
|
||||
Index: transform_iterator_ref.rst
|
||||
===================================================================
|
||||
RCS file: /cvsroot/boost/boost/libs/iterator/doc/transform_iterator_ref.rst,v
|
||||
retrieving revision 1.3
|
||||
retrieving revision 1.15
|
||||
diff -w -d -u -b -r1.3 -r1.15
|
||||
--- transform_iterator_ref.rst 21 Sep 2003 11:13:46 -0000 1.3
|
||||
+++ transform_iterator_ref.rst 15 Jan 2004 00:06:57 -0000 1.15
|
||||
@@ -1,3 +1,5 @@
|
||||
+.. Version 1.3 of this document was accepted for TR1
|
||||
+
|
||||
::
|
||||
|
||||
template <class UnaryFunction,
|
||||
@@ -5,26 +7,55 @@
|
||||
class Reference = use_default,
|
||||
class Value = use_default>
|
||||
class transform_iterator
|
||||
|
||||
Issue 9.37x
|
||||
|
||||
- : public iterator_adaptor</* see discussion */>
|
||||
{
|
||||
- friend class iterator_core_access;
|
||||
public:
|
||||
+ typedef /* see below */ value_type;
|
||||
+ typedef /* see below */ reference;
|
||||
+ typedef /* see below */ pointer;
|
||||
+ typedef iterator_traits<Iterator>::difference_type difference_type;
|
||||
+ typedef /* see below */ iterator_category;
|
||||
+
|
||||
transform_iterator();
|
||||
transform_iterator(Iterator const& x, UnaryFunction f);
|
||||
|
||||
|
||||
Issue 9.43x
|
||||
|
||||
- template<class OtherIterator, class R2, class V2>
|
||||
+ template<class F2, class I2, class R2, class V2>
|
||||
transform_iterator(
|
||||
- transform_iterator<UnaryFunction, OtherIterator, R2, V2> const& t
|
||||
- , typename enable_if_convertible<OtherIterator, Iterator>::type* = 0 // exposition
|
||||
+ transform_iterator<F2, I2, R2, V2> const& t
|
||||
+ , typename enable_if_convertible<I2, Iterator>::type* = 0 // exposition only
|
||||
+ , typename enable_if_convertible<F2, UnaryFunction>::type* = 0 // exposition only
|
||||
);
|
||||
-
|
||||
|
||||
Issues 9.37x and 9.12
|
||||
|
||||
+ Iterator const& base() const;
|
||||
+ reference operator*() const;
|
||||
+ transform_iterator& operator++();
|
||||
+ transform_iterator& operator--();
|
||||
private:
|
||||
- typename transform_iterator::value_type dereference() const;
|
||||
- UnaryFunction m_f;
|
||||
+ Iterator m_iterator; // exposition only
|
||||
+ UnaryFunction m_f; // exposition only
|
||||
};
|
||||
|
||||
|
||||
Issue 9.41x
|
||||
|
||||
+If ``Reference`` is ``use_default`` then the ``reference`` member of
|
||||
+``transform_iterator`` is
|
||||
+``result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type``.
|
||||
+Otherwise, ``reference`` is ``Reference``.
|
||||
+
|
||||
+If ``Value`` is ``use_default`` then the ``value_type`` member is
|
||||
+``remove_cv<remove_reference<reference> >::type``. Otherwise,
|
||||
+``value_type`` is ``Value``.
|
||||
+
|
||||
+
|
||||
|
||||
Issue 9.37x
|
||||
|
||||
+If ``Iterator`` models Readable Lvalue Iterator and if ``Iterator``
|
||||
+models Random Access Traversal Iterator, then ``iterator_category`` is
|
||||
+convertible to ``random_access_iterator_tag``. Otherwise, if
|
||||
+``Iterator`` models Bidirectional Traversal Iterator, then
|
||||
+``iterator_category`` is convertible to
|
||||
+``bidirectional_iterator_tag``. Otherwise ``iterator_category`` is
|
||||
+convertible to ``forward_iterator_tag``. If ``Iterator`` does not
|
||||
+model Readable Lvalue Iterator then ``iterator_category`` is
|
||||
+convertible to ``input_iterator_tag``.
|
||||
+
|
||||
+
|
||||
``transform_iterator`` requirements
|
||||
...................................
|
||||
|
||||
@@ -34,27 +65,55 @@
|
||||
where the type of ``f(*i)`` must be
|
||||
``result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type``.
|
||||
|
||||
|
||||
Issue 9.37x
|
||||
|
||||
-The type ``Iterator`` must at least model Readable Iterator. The
|
||||
-resulting ``transform_iterator`` models the most refined of the
|
||||
+The argument ``Iterator`` shall model Readable Iterator.
|
||||
+
|
||||
+
|
||||
+``transform_iterator`` models
|
||||
+.............................
|
||||
+
|
||||
+The resulting ``transform_iterator`` models the most refined of the
|
||||
following options that is also modeled by ``Iterator``.
|
||||
|
||||
- * Writable Lvalue Iterator if ``result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type`` is a non-const reference.
|
||||
+ * Writable Lvalue Iterator if ``transform_iterator::reference`` is a non-const reference.
|
||||
|
||||
- * Readable Lvalue Iterator if ``result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type`` is a const
|
||||
- reference.
|
||||
+ * Readable Lvalue Iterator if ``transform_iterator::reference`` is a const reference.
|
||||
|
||||
* Readable Iterator otherwise.
|
||||
|
||||
-
|
||||
The ``transform_iterator`` models the most refined standard traversal
|
||||
-concept that is modeled by ``Iterator``.
|
||||
+concept that is modeled by the ``Iterator`` argument.
|
||||
|
||||
Issue 9.41x
|
||||
|
||||
-The ``reference`` type of ``transform_iterator`` is
|
||||
-``result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type``.
|
||||
-The ``value_type`` is ``remove_cv<remove_reference<reference> >::type``.
|
||||
|
||||
Issue 9.37x.
|
||||
|
||||
+If ``transform_iterator`` is a model of Readable Lvalue Iterator then
|
||||
+it models the following original iterator concepts depending on what
|
||||
+the ``Iterator`` argument models.
|
||||
|
||||
-``transform_iterator`` public operations
|
||||
-........................................
|
||||
++-----------------------------------+---------------------------------+
|
||||
+| If ``Iterator`` models | then ``filter_iterator`` models |
|
||||
++===================================+=================================+
|
||||
+| Single Pass Iterator | Input Iterator |
|
||||
++-----------------------------------+---------------------------------+
|
||||
+| Forward Traversal Iterator | Forward Iterator |
|
||||
++-----------------------------------+---------------------------------+
|
||||
+| Bidirectional Traversal Iterator | Bidirectional Iterator |
|
||||
++-----------------------------------+---------------------------------+
|
||||
+| Random Access Traversal Iterator | Random Access Iterator |
|
||||
++-----------------------------------+---------------------------------+
|
||||
+
|
||||
+If ``transform_iterator`` models Writable Lvalue Iterator then it is a
|
||||
+mutable iterator (as defined in the old iterator requirements).
|
||||
+
|
||||
+``transform_iterator<F1, X, R1, V1>`` is interoperable with
|
||||
+``transform_iterator<F2, Y, R2, V2>`` if and only if ``X`` is
|
||||
+interoperable with ``Y``.
|
||||
+
|
||||
+
|
||||
+
|
||||
+``transform_iterator`` operations
|
||||
+.................................
|
||||
+
|
||||
+In addition to the operations required by the concepts modeled by
|
||||
+``transform_iterator``, ``transform_iterator`` provides the following
|
||||
+operations.
|
||||
|
||||
|
||||
``transform_iterator();``
|
||||
@@ -80,14 +139,30 @@
|
||||
:Returns: An instance of ``transform_iterator`` that is a copy of ``t``.
|
||||
:Requires: ``OtherIterator`` is implicitly convertible to ``Iterator``.
|
||||
|
||||
+
|
||||
+``Iterator const& base() const;``
|
||||
+
|
||||
+:Returns: ``m_iterator``
|
||||
+
|
||||
+
|
||||
``UnaryFunction functor() const;``
|
||||
|
||||
:Returns: ``m_f``
|
||||
|
||||
-``transform_iterator`` private operations
|
||||
-.........................................
|
||||
|
||||
-``typename transform_iterator::value_type dereference() const;``
|
||||
+``reference operator*() const;``
|
||||
|
||||
-:Returns: ``m_f(transform_iterator::dereference());``
|
||||
+:Returns: ``m_f(*m_iterator)``
|
||||
+
|
||||
+
|
||||
+``transform_iterator& operator++();``
|
||||
+
|
||||
+:Effects: ``++m_iterator``
|
||||
+:Returns: ``*this``
|
||||
+
|
||||
+
|
||||
+``transform_iterator& operator--();``
|
||||
+
|
||||
+:Effects: ``--m_iterator``
|
||||
+:Returns: ``*this``
|
||||
|
||||
Reference in new issue
Block a user