<分区>
我在我的代码中使用了 bitset:
std::bitset<MAX_INSTRUMENTS_NUMBER_IN_SYSTEM> updatedInstruments;
通常我只需要迭代“设置”(或“未设置”)的值,这就是我的做法:
for (int instrumentId = 0; instrumentId < MAX_INSTRUMENTS_NUMBER_IN_SYSTEM; instrumentId++) {
if (!updatedInstruments[instrumentId]) {
continue;
}
// work
}
能否改进此迭代以使其更具可读性并可能更快?