-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
class iterator doesn't work with stream_iterator #47
Comments
I would like to have a look at it today. I have already spotted multiple calls to operator* moves the actual iterator by one - so if you |
The compilation problem is simple: unchecked iterator constructor takes only one argument, not three. Instead of: for(utf8_iterator iter(it, it, eos) do for(utf8_iterator iter(it) Looking at the rest... |
unchecked::iterator compiles. checked::iterator doesn't. |
Not a bug. The iterator class adapts bi-directional iterators and istream_itrator is an input iterator. |
The |
I tried to convert an istream to a sequence of code points. Unfortunately, you can't use utf8::iterator because it doesn't compile. It's possible to bypass the compilation problem by removing the two blocking lines which are just checks.
The problem is the same with both version of iterator (checked and unchecked) : its converts every two characters. The origin of the cause is the operator*() : it assumes that the injected iterator doesn't change while performing the next method.
I suggest that the class iterator stores the code point.
Here is an other problem : with a stream_iterator, you can't go back ! So operator--() can't work.
I suggest also to provide an end point for the iterator, just like std::istream_iterator so that you can write a classical for loop :
for(utf8::iterator iter ; iter != end ; ++iter) {//do stuff}
I hope you can find a solution.
Regards
The text was updated successfully, but these errors were encountered: