Pushing a vector into an vector
- by Sunil
I have a 2d vector
typedef vector <double> record_t;
typedef vector <record_t> data_t;
data_t data;
So my 2d vector is data here. It has elements like say,
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
5 5 5 5 5
Now I want to insert these elements into another 2d vector
std::vector< vector<double> > window;
So what I did was to create an iterator for traversing through the rows of data and pushing it into windowlike
std::vector< std::vector<double> >::iterator data_it;
for (data_it = data.begin() ; data_it != data.end() ; ++data_it)
window.push_back ( *data_it );
Can anybody tell me where I'm wrong or suggest a way to do this ?
Thanks