Function malachite_base::vecs::vec_delete_left
source · pub fn vec_delete_left<T: Copy>(xs: &mut Vec<T>, delete_size: usize)
Expand description
Deletes several values from the left (beginning) of a Vec
.
Using this function is more efficient than deleting the values one by one.
§Worst-case complexity
$T(n) = O(\operatorname{max}(1, n - m))$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, $n$ = xs.len()
before the function is called, and
$m$ = delete_size
.
§Panics
Panics if delete_size
is greater than xs.len()
.
§Examples
use malachite_base::vecs::vec_delete_left;
let mut xs = vec![1, 2, 3, 4, 5];
vec_delete_left::<u32>(&mut xs, 3);
assert_eq!(xs, [4, 5]);