From e785cc70d11a20434d668fffaea01614796619ff Mon Sep 17 00:00:00 2001 From: Jeremy Siek Date: Mon, 12 Jan 2004 21:18:52 +0000 Subject: [PATCH] some major changes to the requirements/models section of counting_iterator [SVN r21651] --- doc/counting_iterator.html | 44 ++++++++++++++++++++--------------- doc/counting_iterator_ref.rst | 43 ++++++++++++++++++++-------------- doc/iter-issue-list.rst | 8 +++++-- doc/iterator_adaptor.html | 10 ++++---- doc/iterator_facade.html | 10 ++++---- doc/new-iter-concepts.html | 14 +++++------ doc/new-iter-concepts.rst | 12 +++++----- 7 files changed, 79 insertions(+), 62 deletions(-) diff --git a/doc/counting_iterator.html b/doc/counting_iterator.html index ed9fabb..f4bb6b2 100644 --- a/doc/counting_iterator.html +++ b/doc/counting_iterator.html @@ -3,7 +3,7 @@ - + Counting Iterator @@ -92,9 +92,13 @@ class counting_iterator

If the Diference argument is use_default then the difference_type member is an implementation defined signed integral type.

-

The member iterator_category is a type that satisfies the -requirements of the concepts modeled by the counting_iterator as -specified in the models section.

+

If CategoryOrTraversal is not use_default then the member +iterator_category is CategoryOrTraversal. Otherwise, if +Incrementable is a numeric type then iterator_category is a +type convertible to random_access_traversal_tag and +random_access_iterator_tag. If Incrementable is not a numeric +type then iterator_category is +iterator_traversal<Incrementable>::type.

[Note: implementers are encouraged to provide an implementation of
distance_to and a difference_type that avoids overflows in @@ -105,27 +109,22 @@ the cases when the Incrementablecounting_iterator requirements

The Incrementable type must be Default Constructible, Copy Constructible, and Assignable.

- -
-

counting_iterator models

-

counting_iterator models Readable Lvalue Iterator.

-

Furthermore, if you wish to create a counting iterator that is a -Forward Traversal Iterator and also Forward Iterator, then the -following expressions must be valid:

+

If iterator_category is convertible to forward_iterator_tag or +forward_traversal_tag then the following expressions must be valid:

 Incrementable i, j;
 ++i         // pre-increment
 i == j      // operator equal
 
-

If you wish to create a counting iterator that is a Bidirectional -Traversal Iterator and also Bidirectional Iterator, then pre-decrement -is also required:

+

If iterator_category is convertible to +bidirectional_iterator_tag or bidirectional_traversal_tag then +pre-decrement is required:

 --i
 
-

If you wish to create a counting iterator that is a Random Access -Traversal Iterator and also Random Access Iterator, then these -additional expressions are also required:

+

If iterator_category is convertible to +random_access_iterator_tag or random_access_traversal_tag then +these additional expressions are also required:

 counting_iterator::difference_type n;
 i += n
@@ -133,6 +132,13 @@ n = i - j
 i < j
 
+
+

counting_iterator models

+

counting_iterator models Readable Lvalue Iterator. In addition, +counting_iterator models the concepts corresponding to the +iterator tags that counting_iterator::iterator_category is +convertible to.

+

counting_iterator operations

In addition to the operations required by the concepts modeled by @@ -254,10 +260,10 @@ indirectly printing out the numbers from 0 to 7

The source code for this example can be found here.

- + diff --git a/doc/counting_iterator_ref.rst b/doc/counting_iterator_ref.rst index b78cc3b..88f3d42 100644 --- a/doc/counting_iterator_ref.rst +++ b/doc/counting_iterator_ref.rst @@ -30,44 +30,43 @@ If the ``Diference`` argument is ``use_default`` then the ``difference_type`` member is an implementation defined signed integral type. -The member ``iterator_category`` is a type that satisfies the -requirements of the concepts modeled by the ``counting_iterator`` as -specified in the models section. +If ``CategoryOrTraversal`` is not ``use_default`` then the member +``iterator_category`` is ``CategoryOrTraversal``. Otherwise, if +``Incrementable`` is a numeric type then ``iterator_category`` is a +type convertible to ``random_access_traversal_tag`` and +``random_access_iterator_tag``. If ``Incrementable`` is not a numeric +type then ``iterator_category`` is +``iterator_traversal::type``. [*Note:* implementers are encouraged to provide an implementation of ``distance_to`` and a ``difference_type`` that avoids overflows in the cases when the ``Incrementable`` type is a numeric type.] + ``counting_iterator`` requirements .................................. The ``Incrementable`` type must be Default Constructible, Copy Constructible, and Assignable. - -``counting_iterator`` models -............................ - -``counting_iterator`` models Readable Lvalue Iterator. - -Furthermore, if you wish to create a counting iterator that is a -Forward Traversal Iterator and also Forward Iterator, then the -following expressions must be valid:: +If ``iterator_category`` is convertible to ``forward_iterator_tag`` or +``forward_traversal_tag`` then the following expressions must be valid:: Incrementable i, j; ++i // pre-increment i == j // operator equal -If you wish to create a counting iterator that is a Bidirectional -Traversal Iterator and also Bidirectional Iterator, then pre-decrement -is also required:: + +If ``iterator_category`` is convertible to +``bidirectional_iterator_tag`` or ``bidirectional_traversal_tag`` then +pre-decrement is required:: --i -If you wish to create a counting iterator that is a Random Access -Traversal Iterator and also Random Access Iterator, then these -additional expressions are also required:: +If ``iterator_category`` is convertible to +``random_access_iterator_tag`` or ``random_access_traversal_tag`` then +these additional expressions are also required:: counting_iterator::difference_type n; i += n @@ -76,6 +75,14 @@ additional expressions are also required:: +``counting_iterator`` models +............................ + +``counting_iterator`` models Readable Lvalue Iterator. In addition, +``counting_iterator`` models the concepts corresponding to the +iterator tags that ``counting_iterator::iterator_category`` is +convertible to. + ``counting_iterator`` operations ................................ diff --git a/doc/iter-issue-list.rst b/doc/iter-issue-list.rst index 25aa285..b81cce9 100644 --- a/doc/iter-issue-list.rst +++ b/doc/iter-issue-list.rst @@ -980,8 +980,12 @@ categories. There is no description of what the argument to iterator_adaptor should be. -:Proposed resolution: **Needs work** (Jeremy) - +:Proposed resolution: + We no longer inherit from iterator_adaptor. So instead, + we specify the iterator_category in terms of the Traversal type + (which is now called CategoryOrTraversal). Also the + requirements and models section was reorganized to + match these changes and to make more sense. diff --git a/doc/iterator_adaptor.html b/doc/iterator_adaptor.html index ad247c6..36b51aa 100644 --- a/doc/iterator_adaptor.html +++ b/doc/iterator_adaptor.html @@ -3,11 +3,11 @@ - + Iterator Adaptor - + @@ -27,7 +27,7 @@ Lab, University of Hanover Institute for Transport Railway Operation and Construction Date: -2003-09-14 +2004-01-12 Copyright: Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved @@ -433,10 +433,10 @@ adaptors to get an idea of the sorts of things you can do with counting_iterator, which demonstrates that iterator_adaptor's Base type needn't be an iterator.

- + diff --git a/doc/iterator_facade.html b/doc/iterator_facade.html index 3fe145b..d125713 100644 --- a/doc/iterator_facade.html +++ b/doc/iterator_facade.html @@ -3,7 +3,7 @@ - + Iterator Facade @@ -144,7 +144,7 @@ of the derived iterator type. These member functions are described briefly below and in more detail in the iterator facade requirements.

- +
@@ -397,7 +397,7 @@ is a constant object of a random access traversal iterator type interoperable with X.

iterator_facade Core Operations

-
+
@@ -1134,10 +1134,10 @@ even be superior.

- + diff --git a/doc/new-iter-concepts.html b/doc/new-iter-concepts.html index e49ef96..31f5b38 100755 --- a/doc/new-iter-concepts.html +++ b/doc/new-iter-concepts.html @@ -542,7 +542,7 @@ stated semantics.

- + @@ -590,7 +590,7 @@ relation over its domain - + @@ -637,7 +637,7 @@ dereferenceable implies the distance between iterators - + @@ -692,7 +692,7 @@ implies r == - + @@ -805,7 +805,7 @@ ordering relation - + @@ -840,7 +840,7 @@ templates satisfy the true if, for an object a of type X, *a is convertible to iterator_traits<X>::value_type, and false otherwise.

-

iterator_traversal<X>::value_type is defined to be:

+

iterator_traversal<X>::type is defined to be:

 traversal-category(X) =
     cat = iterator_traits<X>::iterator_category;
@@ -878,7 +878,7 @@ LocalWords:  TraversalTag typename lvalues DWA Hmm JGS mis enum -->
 
 
 
diff --git a/doc/new-iter-concepts.rst b/doc/new-iter-concepts.rst
index d30e6ec..679b1c8 100644
--- a/doc/new-iter-concepts.rst
+++ b/doc/new-iter-concepts.rst
@@ -477,7 +477,7 @@ stated semantics.
 |                                |                               |    return tmp;     |
 |                                |                               | }                  |
 +--------------------------------+-------------------------------+--------------------+
-|``traversal_category::type`` |Convertible to                 |                    |
+|``iterator_traversal::type`` |Convertible to                 |                    |
 |                                |``incrementable_traversal_tag``|                    |
 +--------------------------------+-------------------------------+--------------------+
 
@@ -509,7 +509,7 @@ semantics.
 +--------------------------------+-----------------------------+---------------------------+
 |``a != b``                      |convertible to ``bool``      |``!(a == b)``              |
 +--------------------------------+-----------------------------+---------------------------+
-|``traversal_category::type`` |Convertible to               |                           |
+|``iterator_traversal::type`` |Convertible to               |                           |
 |                                |``single_pass_traversal_tag``|                           |
 +--------------------------------+-----------------------------+---------------------------+
 
@@ -541,7 +541,7 @@ stated semantics.
 |                                       |the distance between iterators     |                            |
 |                                       |                                   |                            |
 +---------------------------------------+-----------------------------------+----------------------------+
-|``traversal_category::type``        |Convertible to                     |                            |
+|``iterator_traversal::type``        |Convertible to                     |                            |
 |                                       |``forward_traversal_tag``          |                            |
 +---------------------------------------+-----------------------------------+----------------------------+
 
@@ -581,7 +581,7 @@ respect the stated semantics.
 |                                    |                                             |   return tmp;       |
 |                                    |                                             | }                   |
 +------------------------------------+---------------------------------------------+---------------------+
-|``traversal_category::type``     |Convertible to                               |                     |
+|``iterator_traversal::type``     |Convertible to                               |                     |
 |                                    |``bidirectional_traversal_tag``              |                     |
 |                                    |                                             |                     |
 +------------------------------------+---------------------------------------------+---------------------+
@@ -649,7 +649,7 @@ constant object of type ``Distance``.
 +-------------------------------------------+-------------------------------------------------+-------------------------+----------------------+
 |``a <= b``                                 |convertible to ``bool``                          |``!(a > b)``             |                      |
 +-------------------------------------------+-------------------------------------------------+-------------------------+----------------------+
-|``traversal_category::type``            |Convertible to                                   |                         |                      |
+|``iterator_traversal::type``            |Convertible to                                   |                         |                      |
 |                                           |``random_access_traversal_tag``                  |                         |                      |
 +-------------------------------------------+-------------------------------------------------+-------------------------+----------------------+
 
@@ -684,7 +684,7 @@ yields ``true`` if, for an object ``a`` of type ``X``, ``*a`` is
 convertible to ``iterator_traits::value_type``, and ``false``
 otherwise.
 
-``iterator_traversal::value_type`` is defined to be:
+``iterator_traversal::type`` is defined to be:
 
 .. parsed-literal::
 
traversal_category<X>::type
iterator_traversal<X>::type Convertible to incrementable_traversal_tag   convertible to bool !(a == b)
traversal_category<X>::type
iterator_traversal<X>::type Convertible to single_pass_traversal_tag    
traversal_category<X>::type
iterator_traversal<X>::type Convertible to forward_traversal_tag  
traversal_category<X>::type
iterator_traversal<X>::type Convertible to bidirectional_traversal_tag  !(a > b)  
traversal_category<X>::type
iterator_traversal<X>::type Convertible to random_access_traversal_tag