-
Notifications
You must be signed in to change notification settings - Fork 269
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
Adding standard-conforming iterators for C++ #669
Comments
For header-only C++, we can always mix and match two behaviours... either through macros or some other means. |
Also, we should precisely address what we mean by "backward-compatibility issues". Is it practically significant? |
Well it won't be clear until the implementation is complete. A big part of that will be enhancing the tests for C++ iterators, which are currently a bit too minimal.. But what I was referring to would not just be an issue of recompiling the code or using a shared library. I am more concerned if code that currently uses iterators will have to change in some way. Maybe that won't be necessary. I agree the backward-compatibility situation needs to be clear in the commit message. If this seems like something people are interested in I'll try to find time to polish my changes and put up a PR. |
@madscientist I can't speak for everyone, but I can say that I would welcome progress on this front. It is entirely possible that I am at the root of the problem you are trying to solve btw. |
A few months ago I added a standards-conforming iterator to the C++ interface for 32bit croaring. It's always frustrated me that the iterator support in the C++ interface isn't "right". For example, a conforming forward iterator needs to be an lvalue, but this means an iterator struct can't actually be empty/have no content. The "trick" of using a static "empty" iterator for end() also really bothers me as just "icky" :).
I find this page invaluable for considering iterator classes in C++: https://cplusplus.com/reference/iterator/
The iterators we have are kind of a mishmash of various things but the only type of iterator they actually fully implement is the simple input iterator. All other classes of iterator have something missing.
On the other hand, it's not clear to me that we can implement a "correct" STL iterator without any backward-compatibility issues with what's there now.
What are peoples' thoughts about this.
The text was updated successfully, but these errors were encountered: