66 std::cout <<
"<EMPTY SET>";
68 for (; first != last; ++first)
69 std::cout << *first <<
";";
70 std::cout << std::endl;
76 std::vector<bm_size_type> &v2,
77 std::vector<bm_size_type> &v3)
157 std::vector<bm_size_type> &v2,
158 std::vector<bm_size_type> &v3)
173 std::vector<bm_size_type> &v2,
174 std::vector<bm_size_type> &v3)
215 for (
unsigned i = 0; i <
sizeof(bits) /
sizeof(bits[0]); ++i)
217 bool b = bv1.
set_bit(bits[i],
true);
220 std::cout <<
"Number of bits changed:" << cnt << std::endl;
228 std::cout <<
"Bit 5 set:" << (b ?
" yes " :
" no ") << std::endl;
231 std::cout <<
"Bit 256 set:" << (b ?
" yes " :
" no ") << std::endl;
234 std::cout <<
"Bit 256 set:" << (b ?
" yes " :
" no ") << std::endl;
250 std::cout <<
"Bit 13 set:" << (b ?
" yes " :
" no ") << std::endl;
260 bm::combine_or(bv1, &bits[0], &bits[0] + (
sizeof(bits) /
sizeof(bits[0])));
282 std::cout <<
"Extracted p = " << p << std::endl;
298 std::vector<bm_size_type> v1, v2, v3;
301 for (
unsigned k = 0; k < 1000; ++k)
306 for (i = 0; i < v1.size(); ++i)
307 s = s + s* v1[i] + i;
308 for (i = 0; i < v2.size(); ++i)
309 s = s + s* v2[i] + i;
310 std::cout << s <<
"\r";
313 std::cout << std::endl <<
"Running benchmarks..." << std::endl;
322 std::cout << std::endl;
325 catch(std::exception& ex)
327 std::cerr << ex.what() << std::endl;
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
Algorithms for bvector<> (main include).
Timing utilities for benchmarking (internal).
pre-processor un-defines to avoid global space pollution (internal)
Bitvector Bit-vector container with runtime compression of bits.
bool clear_bit(size_type n)
Clears bit n.
bvector< Alloc > & set(size_type n, bool val=true)
Sets bit n if val is true, clears bit n if val is false.
bvector< Alloc > & reset() BMNOEXCEPT
Clears every bit in the bitvector.
size_type extract_next(size_type prev)
Finds the number of the next bit ON and sets it to 0.
bool set_bit(size_type n, bool val=true)
Sets bit n.
bvector_size_type size_type
enumerator first() const
Returns enumerator pointing on the first non-zero bit.
void swap(bvector< Alloc > &bvect) BMNOEXCEPT
Exchanges content of bv and this bvector.
void init()
Explicit post-construction initialization. Must be caled to make sure safe use of *_no_check() method...
bvector< Alloc > & set_range(size_type left, size_type right, bool value=true)
Sets all bits in the specified closed interval [left,right] Interval must be inside the bvector's siz...
bvector< Alloc > & flip(size_type n)
Flips bit n.
void clear(const size_type *ids, size_type ids_size, bm::sort_order so=bm::BM_UNKNOWN)
clear list of bits in this bitset
bool set_bit_conditional(size_type n, bool val, bool condition)
Sets bit n only if current value equals the condition.
enumerator end() const
Returns enumerator pointing on the next bit after the last.
void set_bit_no_check(size_type n)
Set bit without checking preconditions (size, etc).
Utility class to collect performance measurements and statistics.
std::map< std::string, statistics > duration_map_type
test name to duration map
static void print_duration_map(TOut &tout, const duration_map_type &dmap, format fmt=ct_time)
void combine_or(BV &bv, It first, It last)
OR Combine bitvector and the iterable sequence.
const unsigned benchmark_count
bm::chrono_taker ::duration_map_type timing_map
void PrintContainer(T first, T last)
static void combine_or_test(std::vector< bm_size_type > &v1, std::vector< bm_size_type > &v2, std::vector< bm_size_type > &v3)
static void generate_test_vectors(std::vector< bm_size_type > &v1, std::vector< bm_size_type > &v2, std::vector< bm_size_type > &v3)
static void bv_set_bit_no_check_test()
static void bvector_bulk_set_test(std::vector< bm_size_type > &v1, std::vector< bm_size_type > &v2, std::vector< bm_size_type > &v3)
static void bv_set_bit_test()
bm::bvector ::size_type bm_size_type