Generalize pairs_iterator to generating all combinations for some k.