On Wed, May 21, 2025 at 11:11 PM Jan Schultke <janschultke@googlemail.com> wrote:
"A possible issue is that this operation is extremely specialized towards iteration." comment,  I don't see that as a problem, but that's just my opinion.

The issue is mainly that it's adding a very weird member function that only exists because we don't have a proper bit iterator/range/view for std::bitset yet. The moment something better gets added, this function would be obsolete.

The other options are more justifiable because counting zeros, possibly at a start index, is a general purpose operation. Once you bunch an increment and extra checks into it, the design is no longer easy to justify.

Right, now I see what you mean, that makes sense indeed. Are you aware of any proposals to add any such iterator/range/view for set bits? I feel like this use-case is different enough from more common iterator use-cases that it might be hard to make it feel like a good fit in the standard.

Cheers,
Anders