I'm getting an error with a piece of my code... In the following, "vertices" is defined as a vector of gVector3's, where gVector3 is a float array of length three (x,y,z coordinates of a point). The [] operator has been overloaded for the gVector3 class, so vertices[i][k] returns a float.
I have an error in this line: (*result)[i+k] = vertices[i][k]. The full code as well as the error message is below. Any insights would be appreciated!
float* Polygon::getVertices(){
float* result = new float[vertices.size()*3];
for (int i = 0; i < vertices.size(); i++){
for (int k = 0; k < 3; k++){
(*result)[i+k] = vertices[i][k]; // invalid types for array subscript
}
}
return result;
}