mirror of
https://github.com/boostorg/iterator.git
synced 2025-07-23 17:37:15 +02:00
merged from HEAD
[SVN r35238]
This commit is contained in:
@ -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``
|
@ -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.
|
||||
|
Binary file not shown.
@ -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