permutation_iter_copy

Function permutation_iter_copy 

Source
pub fn permutation_iter_copy<T: Copy>(a: Vec<T>) -> impl Iterator<Item = Vec<T>>
Expand description

Iterates through all permutations of the input. Returns copies of the input.

assert_eq!(
    aoclib_rs::iter::permutation_iter_copy(vec![1, 2, 3]).collect::<Vec<_>>(),
    [
        vec![1, 2, 3],
        vec![2, 1, 3],
        vec![3, 1, 2],
        vec![1, 3, 2],
        vec![2, 3, 1],
        vec![3, 2, 1]
    ]
);