subash23's blog

By subash23, history, 5 years ago, In English

Can anyone suggest me a way to find the previous set bit or next set bit using Bitset STL in C++? I have seen submissions in Java where these functions are pre-defined. Any way to do the same in C++?

  • Vote: I like it
  • +5
  • Vote: I do not like it

»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by subash23 (previous revision, new revision, compare).

»
5 years ago, # |
  Vote: I like it +3 Vote: I do not like it
  • »
    »
    5 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Thanks. Is there any function like Find_prev()?

    • »
      »
      »
      5 years ago, # ^ |
        Vote: I like it +3 Vote: I do not like it

      I couldn't find anything online, so not sure but probably not

»
5 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Implement it. Bitset problems are often time-critical enough that it's better to write something that works fast for a specific case.