Is there a way of iterating over a (possibly huge) std::bitset that is linear in the number of bits that are set to true? I want to prevent ha
std::bitset
Looping over the entire bitset and simply checking the value and storing the index if true, IS linear. You can speed that up though with a lookup table. See this code:
http://xiangqi-engine.cvs.sourceforge.net/viewvc/xiangqi-engine/tsito2/src/Utility.cpp?revision=1.5&view=markup