pub fn vec_pad_left<T: Clone>(xs: &mut Vec<T>, pad_size: usize, pad_value: T)
Expand description

Inserts several copies of a value at the left (beginning) of a Vec.

Using this function is more efficient than inserting the values one by one.

Worst-case complexity

$T(n) = O(n + m)$

$M(n) = O(n + m)$

where $T$ is time, $M$ is additional memory, $n$ = xs.len() before the function is called, and $m$ = pad_size.

Examples

use malachite_base::vecs::vec_pad_left;

let mut xs = vec![1, 2, 3];
vec_pad_left::<u32>(&mut xs, 5, 10);
assert_eq!(xs, [10, 10, 10, 10, 10, 1, 2, 3]);