vendredi 1 juillet 2016

Iterating over all possible bit permutations

Say I want to iterate over all bit sequences (for lack of better name) in the range 0000-1111. When I want to scale it up to 24 bits, I won't be able to simply compute all possible permutations beforehand; I'd need to compute them on the fly.

How can I generate the permutations on-the-fly (like Python generators with yield) using something like InputIterator or a decorated while loop?

Aucun commentaire:

Enregistrer un commentaire