[iterator.traits] (original) (raw)

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 ifIis the type of an iterator, the typeiterator_traits<I>::iterator_categorybe defined as the iterator's iterator category.

In addition, the typesiterator_traits<I>::pointer iterator_traits<I>::referenceshall be defined as the iterator's pointer and reference types; that is, for an iterator object a of class type, the same type asdecltype(a.operator->()) anddecltype(*a), respectively.

The typeiterator_­traits<I>​::​pointershall be voidfor an iterator of class type Ithat does not support operator->.

Additionally, in the case of an output iterator, the typesiterator_traits<I>::value_type iterator_traits<I>::difference_type iterator_traits<I>::referencemay be defined as void.