I'm using std::bitset<9> deck in my program. By default it initializes all bits to 0.
Somewhere in my code I'm doing: deck.flip(index) where index can be any number from 0-8 (bitset indexes).
Now what I need is to find the index of the last bit set to true.
E.g:
000100010 - bitset
876543210 - index
In this example the latest bit set to true is at index 5. That is what I would like to find using std::bitset.
I have read the documentation https://en.cppreference.com/w/cpp/utility/bitset and found no useful function to do this, and as a beginner I'm having a hard time figuring out, how can I do this?
(Sorry if question is poorly written, english is my second language)