Skip to content

Adding standard-conforming iterators for C++ #669

Open
@madscientist

Description

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.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions