もう少しわかりやすくして
このsubsetsイテレータをC++で実装すればいいんだよね

fn subsets<T>(input: &[T]) -> impl Iterator<Item=Vec<&T>> {
let len = input.len();
(0..(1 << len))
.map(move |bits| (0..len)
.filter(|index| bits & (1 << index) != 0)
.map(|index| &input[index])
.collect())
}

fn main() {
let input = ["a", "b", "c"];
for s in subsets(&input) {
println!("{s:?}");
}
}

出力結果
[]
["a"]
["b"]
["a", "b"]
["c"]
["a", "c"]
["b", "c"]
["a", "b", "c"]