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
This is a discussion on STL question: vector size (2 dimension) within the C++ Programming forums, part of the General Programming Boards category; I have a vector < vector<int> > TwoDim; What does TwoDim.size() give me? Is it (x*y), assuming x = rows, ...
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
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.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Which is why Boost.MultiArray is a better choice for most applications than jagged vectors.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law