35 #ifndef FLANN_DYNAMIC_BITSET_H_
36 #define FLANN_DYNAMIC_BITSET_H_
40 #include <boost/dynamic_bitset.hpp>
41 typedef boost::dynamic_bitset<> DynamicBitset;
74 std::fill(bitset_.begin(), bitset_.end(), 0);
82 return bitset_.empty();
89 std::fill(bitset_.begin(), bitset_.end(), 0);
97 bitset_[index / cell_bit_size_] &= ~(size_t(1) << (index % cell_bit_size_));
108 bitset_[index / cell_bit_size_] = 0;
117 bitset_.resize(
size / cell_bit_size_ + 1);
125 bitset_[index / cell_bit_size_] |= size_t(1) << (index % cell_bit_size_);
141 return (bitset_[index / cell_bit_size_] & (
size_t(1) << (index % cell_bit_size_))) != 0;
145 template <
typename Archive>
146 void serialize(Archive& ar)
154 std::vector<size_t> bitset_;
156 static const unsigned int cell_bit_size_ = CHAR_BIT *
sizeof(size_t);
void reset(size_t index)
set one bit to 0
DynamicBitset(size_t size)
void reset_block(size_t index)
sets a specific bit to 0, and more bits too This function is useful when resetting a given set of bit...
bool test(size_t index) const
bool empty() const
checks if the bitset is empty