50 const unsigned fill_factor1 = 2500;
51 const unsigned fill_factor2 = 150;
53 if (
unsigned(rand()) % fill_factor1)
55 for (
unsigned i = 0; i <
MAX_VALUE; i+=fill_factor2)
65 cout <<
"Bit blocks :" << st.
bit_blocks << endl;
66 cout <<
"GAP blocks :" << st.
gap_blocks << endl;
82 cout <<
"Statistics before memory optimization" << endl;
83 cout <<
"-------------------------------------" << endl << endl;
96 cout <<
"Statistics after memory optimization" << endl;
97 cout <<
"-------------------------------------" << endl;
106 assert(bv1_ro.
is_ro());
108 cout << bv2.
is_ro() << endl;
111 cout <<
"Statistics after freezing" << endl;
112 cout <<
"-------------------------------------" << endl;
126 assert(bv11.
is_ro());
127 bool eq = bv11.
equal(bv1_ro);
139 assert(!bv2.
is_ro());
148 catch(std::exception& ex)
150 std::cerr << ex.what() << std::endl;
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
#define BM_DECLARE_TEMP_BLOCK(x)
pre-processor un-defines to avoid global space pollution (internal)
Bitvector Bit-vector container with runtime compression of bits.
bool equal(const bvector< Alloc > &bvect) const BMNOEXCEPT
Equal comparison with an agr bit-vector.
bvector< Alloc > & set(size_type n, bool val=true)
Sets bit n if val is true, clears bit n if val is false.
void optimize(bm::word_t *temp_block=0, optmode opt_mode=opt_compress, statistics *stat=0)
Optimize memory bitvector's memory allocation.
void swap(bvector< Alloc > &bvect) BMNOEXCEPT
Exchanges content of bv and this bvector.
void freeze()
Turn current vector to read-only (immutable vector).
bool is_ro() const BMNOEXCEPT
Returns true if vector is read-only.
void calc_stat(struct bm::bvector< Alloc >::statistics *st) const BMNOEXCEPT
Calculates bitvector statistics.
@ READWRITE
mutable (read-write object)
@ READONLY
immutable (read-only object)
static void print_statistics(const bm::bvector<> &bv)
static void fill_bvector(bm::bvector<> *bv1, bm::bvector<> *bv2)
Fill bit-vectors with values using dense and sparse distrubutions.
size_t gap_cap_overhead
gap memory overhead between length and capacity
size_t gap_blocks
Number of GAP blocks.
size_t bit_blocks
Number of bit blocks.
size_t max_serialize_mem
estimated maximum memory for serialization
size_t memory_used
memory usage for all blocks and service tables
Statistical information about bitset's memory allocation details.