some people here know python. I have used it a tiny bit but not sure what that statement does nor what itertools is. It would go a long way if you could just say in english what you want to do. I took a look at itertools for 30 seconds or so. C++ already has efficient iterators (the #1 point of the library), but if you wanted to bundle up all the extras you can certainly do so.
My thoughts are, what problem are you trying to solve, beyond the exercise of doing it? When you use it in python, which parts do you return to over and over as really useful? Which of the things this library does cannot be done in c++ already with built in tools, and do we generally have a need to do those things? If you see a useful thing here, by all means go for it. May want to check ... is recreating this thing allowed?
The idea is to generate all possible combinations of truth values base on a proposition. The end goal is to generate a Truth Table. Generate all length-n permutations of True/False basically. I'm a noob so I find it harder in C++.
So if n was 2 then: [[True, True], [True, False], [False, True], [False, False]] is what I am trying to get at.
This is, essentially, a bignum addition exercise. C++ doesn't typically support coding patterns that generate list temporaries for gcomputing a result -- not like python does.
A more generalized function to produce a list would be to step through the additions using a single add until you have generated (and stored) all solutions. The number of additions is a simple power: the size of your alphabet raised to the "repeat" power. In this case you have a binary alphabet: false and true.
the trouble is the problem is in a vacuum ... now that you generated it, what did you want it for? Do you need it in a container or just printed? Is binary OK for printing it? If so bitset's to string looks like a winner. Or if you just want it printed, a for loop over integers is a winner. There are a lot of ways to do it, which one depends on what you do with it next, to some extent.
He marked it done with the off the cuff crude code, so I did not go back...
I did exactly what Duthomhas said... the bit shift is 2 to the power (5) ... the for loop does the addition ... the rest of it is just output related ... and its terrible lol...