Combinations on C++
So, i did a combination program on python (using itertools library) for an automation program, but now (since i'm learning c++) i want do to it on c++, but idk the logic behind the itertools part of the code and that's what i'm trying to find so i can "convert" it to c++ code. To better explain what i mean by dont understanding the logic, My python program does this steps: -Gets Input A and B (integer input) -Defines an array with the same size as Input B (so if input is like 5, the array has size 5) -Goes through the array using a loop and attributes to each "slot" of the array it's number, so array[i] = i -Then it uses itertools product and chain methods like this: combination = list(itertools.product(arrayName, repeat=InputA)) result = itertools.chain(combination) And idk what it does (and is in this part that i am confused) but going through "result" will return all the possible combinations. One thing to note: 0/0/1/0 and 0/0/0/1 are different combinations, and if input B is a higher number like 3 or 4 it has to go through all the numbers like 0/4/1/2 Why i'm point this out? I've trying to search this on the internet and on most "combinations solving" posts for them this doesn't matter, 0/0/1/0 is the same as 0/0/0/1 and their combinations don't go through all of them, like instead of return 0/0/3/2 it will instead return 0/0/3/4 This is my python code if it helps to understand what i'm trying to achieve (i'm on pc, not sure if this link works on mobile) https://www.sololearn.com/compiler-playground/cHv64BoCgpQt/#py