So I got a vector of multidimensional arrays of doubles. The vector is created with this code
std::vector<std::array<double, 3>> matrix;
After this the vector is filled with the xy coordinates of points and other informations, and sorted. This is needed so I become the outer shape of a given 2d model. To close the outer shape of the model, I have to copy the informations of the first point to the end of the vector. I know, if I have a vector of vectors I could use code like this.
matrix.push_back(std::vector<double>(3, 0));
int p = matrix.size()-1;
matrix[p][0]=matrix[0][0];
matrix[p][1]=matrix[0][1];
matrix[p][2]=matrix[0][2];
Since I'm using a vector of arrays, this seems to be wrong. I tried to use this code slightly modified.
matrix.push_back(std::array<double, 3>);
But here I get the error message:
class: std::array Error: type name is not allowed
I'm using VisualStudio 2012. Can somebody tell me, what I'm doing wrong?
A std::array
is copyable, so if you want to copy the first item to the end just say:
matrix.push_back(matrix[0]);
As for why you're getting the error, it's because you're passing the name of a type to push_back
rather than an object.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments