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;
227 b = bv1.set_bit_conditional(5,
true,
false);
228 std::cout <<
"Bit 5 set:" << (b ?
" yes " :
" no ") << std::endl;
230 b = bv1.set_bit_conditional(256,
true,
false);
231 std::cout <<
"Bit 256 set:" << (b ?
" yes " :
" no ") << std::endl;
233 b = bv1.set_bit_conditional(256,
true,
true);
234 std::cout <<
"Bit 256 set:" << (b ?
" yes " :
" no ") << std::endl;
241 bv1.set_range(10, 15,
true);
244 bv1.set_range(10, 12,
false);
249 b = bv1.clear_bit(13);
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.
bvector< Alloc > & set(size_type n, bool val=true)
Sets bit n if val is true, clears bit n if val is false.
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.
enumerator end() const
Returns enumerator pointing on the next bit after the last.
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...
size_type extract_next(size_type prev)
Finds the number of the next bit ON and sets it to 0.
bvector< Alloc > & reset() BMNOEXCEPT
Clears every bit in the bitvector.
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
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)
bm::chrono_taker ::duration_map_type timing_map
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