std::iterator (3) - Linux Manuals
std::iterator: std::iterator
NAME
Synopsis
Defined in header <iterator>
template<
class Category,
class T,
class Distance = std::ptrdiff_t, (deprecated in C++17)
class Pointer = T*,
class Reference = T&
> struct iterator;
std::iterator is the base class provided to simplify definitions of the required types for iterators.
Template parameters
Category - the category of the iterator. Must be one of iterator_category_tags.
T - the type of the values that can be obtained by dereferencing the iterator. This type should be void for output iterators.
Distance - a type that can be used to identify distance between iterators
Pointer - defines a pointer to the type iterated over (T)
Reference - defines a reference to the type iterated over (T)
Member types
Member type Definition
iterator_category Category
value_type T
difference_type Distance
pointer Pointer
reference Reference
Example
The following example shows how to implement a input_iterator by inheriting from std::iterator
// Run this code