Minor dynamic_bitset changes

This commit is contained in:
topjohnwu
2022-01-24 22:30:13 -08:00
parent b791dc5e1a
commit c6dcff0ae7
2 changed files with 9 additions and 5 deletions

View File

@@ -94,8 +94,15 @@ public:
}
return slot_list[slot][index];
}
bool operator[] (size_t pos) const {
size_t slot = pos / slot_size;
size_t index = pos % slot_size;
return slot_list.size() > slot && slot_list[slot][index];
}
size_t slots() const { return slot_list.size(); }
slot_type get_slot(size_t slot) const { return slot_list[slot].to_ulong(); }
slot_type get_slot(size_t slot) const {
return slot_list.size() > slot ? slot_list[slot].to_ulong() : 0ul;
}
private:
std::vector<slot_bits> slot_list;
};