To implement algorithms only in terms of iterators, it is sometimes necessary to
determine the iterator category that corresponds to a particular iterator type
. Accordingly, it is required that if
I
is the type of an iterator,
the type
iterator_traits<I>::iterator_category
be defined as the iterator's iterator category
. In addition, the types
iterator_traits<I>::pointer
iterator_traits<I>::reference
shall be defined as the iterator's pointer and reference types;
that is, for an
iterator object
a of class type,
the same type as
decltype(a.operator->()) and
decltype(*a),
respectively
. The type
iterator_traits<I>::pointer
shall be
void
for an iterator of class type
I
that does not support
operator->. Additionally, in the case of an output iterator, the types
iterator_traits<I>::value_type
iterator_traits<I>::difference_type
iterator_traits<I>::reference
may be defined as
void.