63 std::cout <<
"<EMPTY SET>";
65 for (; first != last; ++first)
66 std::cout << *first <<
";";
67 std::cout << std::endl;
73 std::vector<bm_size_type> &v2,
74 std::vector<bm_size_type> &v3)
154 std::vector<bm_size_type> &v2,
155 std::vector<bm_size_type> &v3)
170 std::vector<bm_size_type> &v2,
171 std::vector<bm_size_type> &v3)
212 for (
unsigned i = 0; i <
sizeof(bits) /
sizeof(bits[0]); ++i)
214 bool b = bv1.set_bit(bits[i],
true);
217 std::cout <<
"Number of bits changed:" << cnt << std::endl;
224 b = bv1.set_bit_conditional(5,
true,
false);
225 std::cout <<
"Bit 5 set:" << (b ?
" yes " :
" no ") << std::endl;
227 b = bv1.set_bit_conditional(256,
true,
false);
228 std::cout <<
"Bit 256 set:" << (b ?
" yes " :
" no ") << std::endl;
230 b = bv1.set_bit_conditional(256,
true,
true);
231 std::cout <<
"Bit 256 set:" << (b ?
" yes " :
" no ") << std::endl;
238 bv1.set_range(10, 15,
true);
241 bv1.set_range(10, 12,
false);
246 b = bv1.clear_bit(13);
247 std::cout <<
"Bit 13 set:" << (b ?
" yes " :
" no ") << std::endl;
257 bm::combine_or(bv1, &bits[0], &bits[0] + (
sizeof(bits) /
sizeof(bits[0])));
279 std::cout <<
"Extracted p = " << p << std::endl;
295 std::vector<bm_size_type> v1, v2, v3;
298 for (
unsigned k = 0; k < 1000; ++k)
303 for (i = 0; i < v1.size(); ++i)
304 s = s + s* v1[i] + i;
305 for (i = 0; i < v2.size(); ++i)
306 s = s + s* v2[i] + i;
307 std::cout << s <<
"\r";
310 std::cout << std::endl <<
"Running benchmarks..." << std::endl;
319 std::cout << std::endl;
322 catch(std::exception& ex)
324 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)
Bitvector Bit-vector container with runtime compression of bits.
bvector< Alloc > & reset()
Clears every bit in the bitvector.
bvector< Alloc > & set(size_type n, bool val=true)
Sets bit n if val is true, clears bit n if val is false.
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.
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.
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(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
void PrintContainer(T first, T last)
bm::chrono_taker::duration_map_type timing_map
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