I wrote a C++ iterator to go over an std::string which is UTF-8.
The idea is for the iterator to return char32_t characters instead of bytes. The iterator can be used to go forward or backward. I can also rewind and I suppose the equivalent of rbegin().
Since a character can span multiple bytes, my position within the std::string may jump by 2, 3, or 4 bytes (the library throws if an invalid character is encountered).
This also mean the distance to a certain character does not always increment one by one. In other words, ++it may increment the position by a number from 1 to 4 and --it reverse subtract in a similar manner.
Is that an expected/legal behavior for a C++ iterator?