I have the following data types and variables:
typedef Seq< vector<int> > MxInt2d;
typedef std::vector<int> edge_t;
typedef std::vector< edge_t> edge2d_t;
std::vector< edge2d_t > myEdgesIntersect;
I tried to initialize myEdgesIntersect like:
edge2d_t edge2d(2);
//creating the vector of edges of intersections whenever an intersection is detected
for (int i=0;i<1;i++){
edge2d[0][0]=sweepEvents[i][0];
edge2d[0][1]=sweepEvents[i][1];
edge2d[1][0]=sweepEvents[i+1][0];
edge2d[1][1]=sweepEvents[i+1][1];
std::cout<<edge2d[0][0]<<" "<<edge2d[0][1]<<endl;
std::cout<<edge2d[1][0]<<" "<<edge2d[1][1]<<endl;
myEdgesIntersect.push_back(edge2d);
std::cout<<myEdgesIntersect[i][0][0]<<" "<<myEdgesIntersect[i][0][1]
<<" "<<myEdgesIntersect[i][1][0]<<" "<<myEdgesIntersect[i][1][1]<<endl;
}
But using this syntax when I try to display the variable myEdgesIntersect this is not initialized with the given values of edge2d[..][..] (which during the display are okay). I tried to display the variable myEdgesIntersect before the push_back and I got an bus error, so I think the problem is that the variable is not initialized. I tried to initialize it like:
edge2d_t edge2d;
edge2d[0][0]=0;
edge2d[0][0]=0;
edge2d[0][0]=0;
edge2d[0][0]=0;
edge2d[0][0]=0;
myEdgesIntersect.push_back(edge2d);
but I got the same error, as actually is the same thing as in the loop. Apparently I do not know how to initialize this quite complicated variable that I really need. If you have any suggestions I would be more than happy.
thanks in advance, madalina