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 to 0 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 if WIDTH == 0.

Load vector from file.

Arguments

  • path - File path.

Get the i-th element of the vector.

Arguments

  • index - An index in range $ [0, \mathrm{len}()) $.

Set the i-th element of the vector.

Arguments

  • index - An index in range $ [0, \mathrm{len}()) $.
  • value - New element value.

Returns true if the vector is empty, otherwise returns false.

Resize the vector in terms of elements.

Arguments

  • size - Target number of elements.

Resize the total vector in terms of bits.

Arguments

  • size - The size to resize the vector in terms of bits.

The number of elements in the vector.

Maximum size of the vector.

The number of bits in the vector.

Returns the size of the occupied bits of the vector.

The capacity of a vector is greater or equal to the bit_size().

Constant pointer to the raw data of the vector.

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.

Returns an iterator over the vector values.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.