43 std::unique_ptr<bm::bvector<>::rs_index_type>
49 auto r1 = bv.
rank(20, *rs_idx);
50 std::cout << r1 << std::endl;
52 r1 = bv.
rank(21, *rs_idx);
53 std::cout << r1 << std::endl;
55 r1 = bv.
rank(30, *rs_idx);
56 std::cout << r1 << std::endl;
68 std::cout << r1c << std::endl;
70 std::cout << r1c << std::endl;
72 std::cout << r1c << std::endl;
78 bool found = bv.
select(2, pos, *rs_idx);
80 std::cout << pos << std::endl;
82 std::cout <<
"Rank not found." << std::endl;
84 found = bv.
select(2, pos, *rs_idx);
86 std::cout << pos << std::endl;
88 std::cout <<
"Rank not found." << std::endl;
90 found = bv.
select(5, pos, *rs_idx);
92 std::cout << pos << std::endl;
94 std::cout <<
"Rank not found." << std::endl;
97 catch(std::exception& ex)
99 std::cerr << ex.what() << std::endl;
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
pre-processor un-defines to avoid global space pollution (internal)
Bitvector Bit-vector container with runtime compression of bits.
size_type rank(size_type n, const rs_index_type &rs_idx) const BMNOEXCEPT
Returns rank of specified bit position (same as count_to()).
bool select(size_type rank, size_type &pos, const rs_index_type &rs_idx) const BMNOEXCEPT
select bit-vector position for the specified rank(bitcount)
bvector_size_type size_type
size_type rank_corrected(size_type n, const rs_index_type &rs_idx) const BMNOEXCEPT
Returns rank corrceted by the requested border value (as -1).
rs_index< allocator_type > rs_index_type
void build_rs_index(rs_index_type *rs_idx, bvector< Alloc > *bv_blocks=0) const
compute running total of all blocks in bit vector (rank-select index)