Note. After reading the message templatetypedef it seems like I'm trying to calculate the Cartesian product of a set with me a certain number of times.
I'm not quite sure that the problem I'm trying to solve is being caused, but it seems pretty close to swapping with a replacement for me.
This is basically my problem. For an array, for example:
{1, 2, 3}
and size, say 2. I need to output:
{1,1},{1,2},{1,3},{2,1},{2,2},...
If the size is 3, it will be
{1,1,1},{1,1,2},{1,1,3},{1,2,1},{1,2,2},{1,2,3},{1,3,1}...
How can I do it?
For the purposes of my problem, I have an input size of 15 numbers, so I think I could create 15 for loops, but this seems like a hack to me.
Thanks.
Edit: I edited my problem without making sure what I asked and what I really need is essentially the same problem. After reading the templatetypedef post, it seems like I'm trying to calculate the Cartesian product of a set with the size itself once.