42 std::unique_ptr<bm::bvector<>::rs_index_type>
48 auto r1 = bv.
rank(20, *rs_idx);
49 std::cout << r1 << std::endl;
51 r1 = bv.
rank(21, *rs_idx);
52 std::cout << r1 << std::endl;
54 r1 = bv.
rank(30, *rs_idx);
55 std::cout << r1 << std::endl;
67 std::cout << r1c << std::endl;
69 std::cout << r1c << std::endl;
71 std::cout << r1c << std::endl;
77 bool found = bv.
select(2, pos, *rs_idx);
79 std::cout << pos << std::endl;
81 std::cout <<
"Rank not found." << std::endl;
83 found = bv.
select(2, pos, *rs_idx);
85 std::cout << pos << std::endl;
87 std::cout <<
"Rank not found." << std::endl;
89 found = bv.
select(5, pos, *rs_idx);
91 std::cout << pos << std::endl;
93 std::cout <<
"Rank not found." << std::endl;
96 catch(std::exception& ex)
98 std::cerr << ex.what() << std::endl;
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
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)
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)