by fjfaase · 5y ago · 0 comments
The most common case, are forward output iterators, for which I usually define a class that defines the methods more and next, that can be used as:
for (MyIterator it(data); it.more(); it.next())
How it decides to compare equal to the .end() instance is also your call. Your example is not a compliant iterator (as in, wouldn't work in a range-based for loop) - yet the same behaviour would be achievable through your own operator++() and operator bool(),