we assume that each found element in the bitset has approximately same complexity, so to model the situation we need to find range boundaries with the specifed population count
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
{
try
{
const unsigned ranges = 3;
cout << "Target split rank:" << split_rank << endl;
for (size_t k = 0; k < pair_vect.size(); ++k)
{
const auto& p = pair_vect[k];
cout << k << ": [" << p.first << ".." << p.second << "] ";
{
auto v = *en;
if (v > p.second)
break;
cout << v << ", ";
}
cout << endl;
}
}
catch(std::exception& ex)
{
std::cerr << ex.what() << std::endl;
return 1;
}
return 0;
}
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
Algorithms for bvector<> (main include)
pre-processor un-defines to avoid global space pollution (internal)
Constant iterator designed to enumerate "ON" bits.
bool valid() const BMNOEXCEPT
Checks if iterator is still valid.
Bitvector Bit-vector container with runtime compression of bits.
bvector_size_type size_type
void rank_range_split(const BV &bv, typename BV::size_type rank, PairVect &target_v)
Algorithm to identify bit-vector ranges (splits) for the rank.
bm::bvector ::size_type bv_size_type
std::vector< std::pair< bv_size_type, bv_size_type > > bv_ranges_vector