Input_iterator is an iterator base class: it is intended that an
iterator that is a model of Input Iterator, and whose value type
and distance type are T and Distance, may be defined by inheriting from
input_iterator<T, Distance>[1]. Input_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.
Example
class my_input_iterator : public input_iterator<double>
{
...
};
This declares my_input_iterator to be an Input Iterator whose
value type is double and whose distance type is ptrdiff_t.
If Iter is an object of class my_input_iterator, then
iterator_category(Iter) will return input_iterator_tag(),
value_type(Iter) will return (double*) 0, and distance_type(Iter)
will return (ptrdiff_t*) 0.
[1]
It is not required that an Input Iterator inherit from the
base input_iterator. It is, however, required that the functions
iterator_category, distance_type, and value_type
be defined for every Input Iterator.
(Or, if you are using the iterator_traits mechanism, that
iterator_traits is properly specialized for every Input Iterator.)
Since those functions are defined for the base input_iterator, the
easiest way to ensure that are defined for a new iterator class is to
derive that class from input_iterator and rely on the
derived-to-base standard conversion of function arguments.