Skip to content
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

Feature Request: iter_ones_from #200

Open
Spoonbender opened this issue Nov 20, 2022 · 1 comment
Open

Feature Request: iter_ones_from #200

Spoonbender opened this issue Nov 20, 2022 · 1 comment

Comments

@Spoonbender
Copy link

Currently, iter_ones and iter_zeros always begin from the first position (front is set to zero) and there is no easy way to begin iterating at a certain position.

It would be helpful if we could call iter_ones_from(start_index) in order to start iterating the ones from the specified position (note: position in the bitvec, not within the ones). Same for iter_zeros_from of course.

This is somewhat achievable using slices, but requires book-keeping in order to recalculate the absolute indexes from the slice-relative indexes.

If this sounds like a good addition, I'd be glad to try and send a PR.

@myrrlyn
Copy link
Collaborator

myrrlyn commented Nov 22, 2022

What would be the difference between bits_full.iter_ones_from(start) and bits_full[start ..].iter_ones()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants