Struct sdsl::int_vectors::IntVector [−][src]
pub struct IntVector<const WIDTH: u8> { /* fields omitted */ }
Expand description
A generic vector for integers of width $ [1..64] $ bits.
This generic vector class can be used to generate a vector that contains integers of fixed width $ [1..64] $.
Arguments
WIDTH
- Width of an integer. If set to0
it is variable during runtime, otherwise fixed at compile time.
Example
let mut iv = sdsl::int_vectors::IntVector::<0>::new(5, 42, Some(64))?; iv.bit_resize(2 * iv.width() as usize); let result: Vec<_> = iv.iter().collect(); let expected = vec![42, 42]; assert_eq!(result, expected);
For further examples see here.
Implementations
Construct a new integer vector.
Arguments
size
- Number of elements.default_value
- Default values for elements initialization.width
- The width of each integer. Must be specified ifWIDTH == 0
.
Set the i-th element of the vector.
Arguments
index
- An index in range $ [0, \mathrm{len}()) $.value
- New element value.
Resize the total vector in terms of bits.
Arguments
size
- The size to resize the vector in terms of bits.
Returns the size of the occupied bits of the vector.
The capacity of a vector is greater or equal to the
bit_size()
.
Returns the width of the integers which are accessed via the get(...)
method.
Sets the width of the integers which are accessed via the get(...)
method, if WIDTH
equals 0.
This function does not bit resize each element in the vector. Rather, after using this function, the raw data of the vector will be interpreted differently.
Arguments
width
- New width of the integers.
Trait Implementations
Auto Trait Implementations
impl<const WIDTH: u8> RefUnwindSafe for IntVector<WIDTH>
impl<const WIDTH: u8> UnwindSafe for IntVector<WIDTH>
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self