Converting 2D vector to 2D array
问题 It's been a while since I last visited arrays (I've been working with vectors recently) and I need to convert an 2D vector back into a 2D array because of a library I am using accepts the paramaters of type double array where the accessors of this array is foo[i][j] for example. Here is my code: double** setupHMM(vector<vector<double> > &vals, int N, int M) { double** temp; temp = new double[N][M]; for(unsigned i=0; (i < N); i++) { for(unsigned j=0; (j < M); j++) { temp[i][j] = vals[i][j]; }