Hi
I'm trying to write a code that have vector and this vector holds another vectors and i cant find out how to push vectors into this "array" of vectors
my code looks like this:
1 2 3 4 5 6 7
vector<vector<int> > *varVect;
//this is the vector pointer that need to hold the other vectors
vector<int> var;
//i creates on loop this vector with values
//and every time its full i need to insert it to the array of vectors
the vector<int> var works fine,after i insert values i print it and its ok
but when i try to insert it to the other vector and the trying to print all the list of vectors its not working
i need to know how can i insert a vector to list of vectors properly and how to work in vectors in the list
1 2 3 4 5 6 7 8 9 10 11 12
for(int j=0;j<varDim;j++){
instr >> num; //enter some numbers to the vector
var.push_back(num);
}
varVect[i].push_back(var); //this is how i enter the vector to the list of vectors
//this is my print function (work good on vector<int> var
void fileHandling::printVector(vector<int>& vec){
for (vector<int>::size_type i = 0; i < vec.size(); i++)
cout<<vec[i]<<" ";
cout<<"\n";
}