I have a

vector < vector<int> > TwoDim;

What does TwoDim.size() give me? Is it (x*y), assuming x = rows, y = columns in the sense of an array?

How do I get the size of x?

How do I get the size of y?

Thanks,

codeguy

Printable View

- 02-08-2008codeguySTL question: vector size (2 dimension)
I have a

vector < vector<int> > TwoDim;

What does TwoDim.size() give me? Is it (x*y), assuming x = rows, y = columns in the sense of an array?

How do I get the size of x?

How do I get the size of y?

Thanks,

codeguy - 02-08-2008Elysia
It gives the number of vector<int> in your vector (aka, the size of x).

vector[n].size() gives the size of your y size. - 02-08-2008matsp
- 02-08-2008CornedBee
Which is why Boost.MultiArray is a better choice for most applications than jagged vectors.