i have a problem and i´ve been strugglingfor hours to solve it but i dont find the way.
I have a vector<vector<string>> mat
which i dont know the size, the only thing i know is that there are the same number of strings on each vector. Now, what Im trying to do is to get all the possible combinations of those strings such like:
Imagine that mat.size()
= 3 and mat[0].size()
= 3(remember, all the vectors have same number of strings, so it doesnt matter if make mat[0].size()
or mat[3].size()
) what i would like is to get all the strings on this positions
0,0 0,1 0,2
0,0 0,1 1,2
0,0 0,1 2,2
0,0 1,1 0,2
0,0 1,1 1,2
0,0 1,1 2,2
0,0 2,1 0,2
0,0 2,1 1,2
0,0 2,1 2,2
1,0 0,1 0,2
And so on....
Each row will be stored on a new array/vector
Any idea?
EDIT(in case is not really clear):
Imagine that mat
has the next data:
mat[0] ={aa,bb,cc}
mat[1] ={dd,ee,ff}
mat[2] ={gg,hh,ll}
what i want to get somehow is:
aa,bb,cc
aa,bb,ff
aa,bb,ll
aa,ee,cc
aa,ee,ff
aa,ee,ll
aa,hh,cc
aa,hh,ff
aa,hh,ll
And so on...