Struct sdsl::bit_vectors::BitVector [−][src]
pub struct BitVector { /* fields omitted */ }
Expand description
Implementations
Construct a new bit vector.
Arguments
size
- Number of elements.default_value
- Default values for elements initialization.
Returns the size of the occupied bits of the vector.
The capacity of a vector is greater or equal to the
bit_size()
.
Get the integer value of the binary string of length len
starting at position index
in the vector.
Arguments
index
- Starting index of the binary representation of the integer.len
- Length of the binary representation of the integer.
Example
ⓘ
// 1, 2, 4, 8, 16 let bv = sdsl::bit_vector! {1, 1, 0, 0, 1}; let result = bv.get_int(0, 5); let expected = 19; // = 1 + 2 + 16 assert_eq!(result, expected);
Set the bits from position index
to index+len-1
to the binary representation of integer value
.
The bit at position index
represents the least significant bit (lsb), and the bit at
position index+len-1
the most significant bit (msb) of value
.
Arguments
index
- Starting index of the binary representation ofvalue
.value
- The integer to store in the vector.len
- The length used to storevalue
in the vector.
Set the i-th element of the vector.
Arguments
index
- An index in range $ [0, \mathrm{len}()) $.value
- New element value.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for BitVector
impl UnwindSafe for BitVector
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self