The C++17 standard 27.2.1.8
says:
An iterator j is called reachable from an iterator i if and only if there is a finite sequence of applications of the expression ++i that makes i == j.
That is to say, any conforming iterator type must provide operator ==
.
However, I find nothing about operator !=
is a requirement for iterator types.
Does the C++ standard require operator !=
must be provided for a given iterator type?
See C++17 [input.iterators]/2 Table 95 "Input iterator requirements".
Input iterators require that a != b
is valid and behaves the same as !(a == b)
if the latter is valid. Link to cppreference.com summary
Output iterators do not need to support either operation.