||Component type: type
Forward_iterator is an iterator base class: it is intended that an
iterator that is a model of Forward Iterator, and whose value type
and distance type are T and Distance, may be defined by inheriting from
forward_iterator<T, Distance> . Forward_iterator is entirely empty: it has no
member functions, member variables, or nested types. It exists solely
to simplify the definition of the functions iterator_category,
distance_type, and value_type.
class my_forward_iterator : public forward_iterator<double>
This declares my_forward_iterator to be a Forward Iterator whose
value type is double and whose distance type is ptrdiff_t.
If Iter is an object of class my_forward_iterator, then
iterator_category(Iter) will return forward_iterator_tag(),
value_type(Iter) will return (double*) 0, and distance_type(Iter)
will return (ptrdiff_t*) 0.
Defined in the standard header iterator, and in the
nonstandard backward-compatibility header iterator.h.
This class is no longer part of the C++ standard, although
it was present in early drafts of the standard. It is retained
in this implementation for backward compatibility.
The iterator's value type
The iterator's distance type
Public base classes
The distance type must be a signed integral type.
Public base classes
It is not required that a Forward Iterator inherit from the
base forward_iterator. It is, however, required that the functions
iterator_category, distance_type, and value_type
be defined for every Forward Iterator.
(Or, if you are using the iterator_traits mechanism, that
iterator_traits is properly specialized for every Forward Iterator.)
Since those functions are defined for the base forward_iterator, the
easiest way to ensure that are defined for a new type is to derive
that class from forward_iterator and rely on the derived-to-base
standard conversion of function arguments.
The Iterator Tags overview, iterator_traits,
1999 Silicon Graphics, Inc. All Rights Reserved.