51 unsigned start =
MAX_VALUE / (unsigned)(rand()%10);
52 for (
unsigned i = start; i <
MAX_VALUE; ++i)
72 cout <<
"bv1 count = " << bv1.
count() << endl;
73 cout <<
"bv2 count = " << bv2.
count() << endl;
78 found = bv1.
find(first);
80 cout <<
"bv1 first = " << first << endl;
85 found = bv1.
find(first, pos);
88 cout <<
"bv1 pos = " << pos << endl;
95 found = bv1.
find(first+1, second);
98 cout <<
"bv1 second = " << second << endl;
99 assert(second > first);
100 assert(bv1.
test(second));
105 cout <<
"bv1 last = " << last << endl;
107 found = bv2.
find(first);
109 cout <<
"bv2 first = " << first << endl;
113 cout <<
"bv2 last = " << last << endl;
117 cout <<
"bv1 range = [" << first <<
", " << last <<
"]" << endl;
121 cout <<
"bv2 range = [" << first <<
", " << last <<
"]" << endl;
124 catch(std::exception& ex)
126 std::cerr << ex.what() << std::endl;
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
pre-processor un-defines to avoid global space pollution (internal)
Bitvector Bit-vector container with runtime compression of bits.
bool find(size_type &pos) const BMNOEXCEPT
Finds index of first 1 bit.
bool test(size_type n) const BMNOEXCEPT
returns true if bit n is set and false is bit n is 0.
size_type count() const BMNOEXCEPT
population count (count of ON bits)
bool find_range(size_type &first, size_type &last) const BMNOEXCEPT
Finds dynamic range of bit-vector [first, last].
bvector< Alloc > & set(size_type n, bool val=true)
Sets bit n if val is true, clears bit n if val is false.
bvector_size_type size_type
bool find_reverse(size_type &pos) const BMNOEXCEPT
Finds last index of 1 bit.
static void fill_bvector(bm::bvector<> *bv)