All iterators must be both pre- and post-incrementable. This is part of the requirements for both input and output iterators. See C++11 §24.2[iterator.requirements] Tables 107 and 108. It's rather hard to quote the tables, but in both tables, the expression ++r
and r++
must be valid for an iterator r
.
So, no. If you are implementing a new iterator type, instances of that type must be both pre- and post-incrementable, and all STL algorithms and any other functions that take iterators may assume post-incrementability.
Because iterators must also be copy constructible, it is generally trivial to implement the postincrement operator in terms of the preincrement operator. For example,
MyIterator operator++(int)
{
MyIterator original(*this);
++*this;
return original;
}