31 std::size_t
size()
const {
return impl().size_impl(); }
45 return impl().bit_impl(position);
53 std::uint64_t
rank(std::size_t end_position)
const {
54 return impl().rank_impl(end_position);
62 std::uint64_t
rank0(std::size_t end_position)
const {
64 : end_position -
rank(end_position);
73 return impl().select_impl(
rank);
82 return impl().select0_impl(
rank);
102 requires requires(const Impl& concrete) {
104 concrete.memory_usage_bytes_impl()
105 } -> std::convertible_to<std::size_t>;
108 return impl().memory_usage_bytes_impl();
117 result.reserve(
size());
118 for (std::size_t i = 0; i <
size(); ++i) {
119 result.push_back((*
this)[i] ?
'1' :
'0');
126 const Impl& impl()
const {
return static_cast<const Impl&
>(*this); }
CRTP facade for immutable rank/select queries and bit access.
Definition rank_select.h:25
bool empty() const
Check whether the bit vector is empty.
Definition rank_select.h:37
std::uint64_t select(std::size_t rank) const
Return the position of the rank-th one bit.
Definition rank_select.h:72
std::size_t memory_usage_bytes() const
Return owned index memory usage when provided by the implementation.
Definition rank_select.h:101
std::uint64_t select0(std::size_t rank) const
Return the position of the rank-th zero bit.
Definition rank_select.h:81
bool supports_select1() const
Check whether select queries for one bits are enabled.
Definition rank_select.h:89
std::uint64_t rank0(std::size_t end_position) const
Count zero bits in the prefix [0, end_position).
Definition rank_select.h:62
std::size_t size() const
Return the number of valid bits.
Definition rank_select.h:31
std::string to_string() const
Convert the logical bits to a binary string.
Definition rank_select.h:115
bool supports_select0() const
Check whether select queries for zero bits are enabled.
Definition rank_select.h:95
int operator[](std::size_t position) const
Read a bit by zero-based position.
Definition rank_select.h:44
std::uint64_t rank(std::size_t end_position) const
Count one bits in the prefix [0, end_position).
Definition rank_select.h:53