mirror of
https://github.com/boostorg/iterator.git
synced 2025-07-29 04:17:32 +02:00
resolved some issues with counting_iterator
[SVN r21639]
This commit is contained in:
@ -8,6 +8,12 @@
|
||||
class counting_iterator
|
||||
{
|
||||
public:
|
||||
typedef Incrementable value_type;
|
||||
typedef const Incrementable& reference;
|
||||
typedef const Incrementable* pointer;
|
||||
typedef /* see below */ difference_type;
|
||||
typedef /* see below */ iterator_category;
|
||||
|
||||
counting_iterator();
|
||||
counting_iterator(counting_iterator const& rhs);
|
||||
explicit counting_iterator(Incrementable x);
|
||||
@ -20,6 +26,15 @@
|
||||
};
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
||||
[*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.]
|
||||
@ -28,8 +43,7 @@
|
||||
..................................
|
||||
|
||||
The ``Incrementable`` type must be Default Constructible, Copy
|
||||
Constructible, and Assignable. The default distance is
|
||||
an implementation defined signed integral type.
|
||||
Constructible, and Assignable.
|
||||
|
||||
|
||||
``counting_iterator`` models
|
||||
@ -37,21 +51,23 @@ an implementation defined signed integral type.
|
||||
|
||||
``counting_iterator`` models Readable Lvalue Iterator.
|
||||
|
||||
Furthermore, if you wish to create a counting iterator that is a Forward
|
||||
Traversal Iterator, then the following expressions must be valid::
|
||||
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::
|
||||
|
||||
Incrementable i, j;
|
||||
++i // pre-increment
|
||||
i == j // operator equal
|
||||
|
||||
If you wish to create a counting iterator that is a
|
||||
Bidirectional Traversal Iterator, then pre-decrement is also required::
|
||||
If you wish to create a counting iterator that is a Bidirectional
|
||||
Traversal Iterator and also Bidirectional Iterator, then pre-decrement
|
||||
is also required::
|
||||
|
||||
--i
|
||||
|
||||
If you wish to create a counting iterator that is a Random Access
|
||||
Traversal Iterator, then these additional expressions are also
|
||||
required::
|
||||
Traversal Iterator and also Random Access Iterator, then these
|
||||
additional expressions are also required::
|
||||
|
||||
counting_iterator::difference_type n;
|
||||
i += n
|
||||
|
Reference in New Issue
Block a user