class
<iterator>

std::input_iterator_tag

struct input_iterator_tag {};
Input iterator category
Empty class to identify the category of an iterator as an input iterator:

Input iterators


Input iterators are iterators that can be used in sequential input operations, where each value pointed by the iterator is read only once and then the iterator is incremented.

All forward, bidirectional and random-access iterators are also valid input iterators.

There is not a single type of input iterator: Each container may define its own specific iterator type able to iterate through it and access its elements. But all input iterators support -at least- the following operations:

propertyvalid expressions
Is copy-constructible, copy-assignable and destructibleX b(a);
b = a;
Can be compared for equivalence using the equality/inequality operators
(meaningful if both iterators are be in domain).
a == b
a != b
Can be dereferenced as an rvalue (if in a dereferenceable state).*a
a->m
Can be incremented (if in a dereferenceable state).
The result is either also dereferenceable or a past-the-end iterator.
The previous iterator value is not required to be dereferenceable after the increase.
++a
(void)a++
*a++
Its value type does not need to be assignablet = u not required
propertyvalid expressions
Is copy-constructible, copy-assignable and destructibleX b(a);
b = a;
Can be compared for equivalence using the equality/inequality operators
(meaningful if both iterators are be in domain).
a == b
a != b
Can be dereferenced as an rvalue (if in a dereferenceable state).*a
a->m
Can be incremented (if in a dereferenceable state).
The result is either also dereferenceable or a past-the-end iterator.
The previous iterator value is not required to be dereferenceable after the increase.
++a
(void)a++
*a++
Its value type does not need to be assignablet = u not required
Lvalues are swappable.swap(a,b)

Where X is an input iterator type, a and b are objects of this iterator type, and t and u are objects of the type pointed by the iterator type.

Algorithms requiring input iterators should be single-pass input algorithms: algorithms pass through an iterator position once at most.

See also