mardi 19 juillet 2016

Is there a C++ aggregate copy (not initialize)?

I want to assign a literal aggregate of 8 values to A[2*i] as shown below but I get "expecting expression" error for the value on the rhs (neither std=c++11 nor std=c++14 help)

void homography(int N, const double src[][2], const double dst[][2], double H[3][3]) {                                                                               
  vector<vector<double> > A(2*N, vector<double>(8));
  for (int i = 0; i < N; i++) {
    A[2*i]   = {src[i][0], src[i][1], 1, 0, 0, 0, -src[i][0]*dst[i][0], -src[i][1]*dst[i][0]});
    A[2*i+1] = {0, 0, 0, src[i][0], src[i][1], 1, -src[i][0]*dst[i][1], -src[i][1]*dst[i][1]};
  }
  ...
}

Is there an aggregate assign (not initialize) with a literal value in C++?

Aucun commentaire:

Enregistrer un commentaire