Skip to content

Navigation Menu

Sign in
Sign up

[C++] Add iterator-based variants of bit-run visitors #51289

Open

Description

Describe the enhancement requested

VisitBitRuns, VisitSetBitRuns, VisitTwoSetBitRuns are useful in many cases but some times the caller needs to control the control flow, for example for returning early.

So it would be nice to be able to write:

 for (const auto run : IterateBitRuns(bitmap, offset, length)) {
 // do something with run.position, run.length, run.set
 }
 // or:
 for (const auto run : IterateSetBitRuns(bitmap, offset, length)) {
 // do something with run.position, run.length
 }
 // or:
 for (const auto run : IterateTwoSetBitRuns(
 left_bitmap, left_offset, right_bitmap, right_offset, length)) {
 // do something with run.position, run.length
 }

The same transformation could be done for VisitBitBlocks, VisitTwoBitBlocks.

Component(s)

C++

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      AltStyle によって変換されたページ (->オリジナル) /