Connecting Tech Pros Worldwide Forums | Help | Site Map

load matrix into a vector of vectors

Newbie
 
Join Date: Jun 2006
Posts: 3
#1: Oct 22 '06
hi,

is there an efficient for to insert the elements of a 2d array into a vector of vectors?
I have
Expand|Select|Wrap|Line Numbers
  1.  
  2.     vector< vector <int> >  Points
  3.  
  4.     for (i = 0; i < n; i++ )
  5.           Points.push_back(vector<int>(d));
  6.  
  7.         int Matrix[n][d];
  8.  
  9.         //populate matrix....
  10.  
  11.         //How to load the data in the Matrix into the vector of v. Points?
  12.         // is there something better than
  13.         //iteratation through:
  14.         Points[i][j] = Matrix[i][j]
  15.  
  16.  
thanks for the help

Reply


Similar C / C++ bytes