+ 5
C++ multi-D vectors
which c++ standard allows the declaration of a multi - dimensional vector in a class in header file and its population in the cpp file? my ide shows weird errors when I try that.
1 Réponse
+ 2
#include <vector>
...
//2-D vector of vector
vector<vector<dataType> > mVector;
vector<dataType> mRow;
mRow.push_back(data);
mRow.push_back(data);
mRow.push_back(data);
mVector.push_back(mRow);
mRow.clear();
....
continue to push vectors onto the 2-D vector.
you can access them as mVector[0][0]
***check out my file:
cpp_2DVectorSummary
in my profile for more help.
hopes this helps