|
vector<vector<int> > twoDim(20, vector<int>(20, 0));
|
vector of vector is ok but the array is ragged
I only know two way to do it
1 : define a data structure by myself("new" the memory by myself)
2 : use boost::multi_array
3 : simulate one dimension vector as two dimension vector
1 2
|
vector<int> A(row * col);//.... do something
A(2 * col + size )
|
About the first choice, I don't want to define my data structure
if the standard library could do it for me, so I pass it for now
The second choice, not everyone know boost especially if you were
not at the right place like me(I am an EE student, an amateur of
C++ like the other EE students).
The third choice, the syntax may not so intuitive
Do you have any ideas?Thanks a lot