selector_iter

Function selector_iter 

Source
pub fn selector_iter(len: usize) -> impl Iterator<Item = Vec<bool>>
Expand description

Iterates through a “selector” of len elements, generating every possible selection. The idea is that you “select” the elements in some other structure at the indices where the returned Vec is true. Put another way, the returned Vec<bool>s can be looked at as counting up in binary.

assert_eq!(
    aoclib_rs::iter::selector_iter(2).collect::<Vec<_>>(),
    [
        vec![false, false],
        vec![false, true],
        vec![true, false],
        vec![true, true]
    ]
);