C++ STL containters to Glib conversion

352 views Asked by At

I am trying to convert C++ code with STL containers to C and Glib. Is that correct?

//vector<pair<int, int> > coordinates;
GArray coordinates((int, int));

//vector<vector<int> > adj_Matrix;
GArray adj_Matrix(GArray(int));

//vector<vector<int> > path_indices;
GArray path_indices(GArray(int));

//vector<pair<int, int> > connecting_indices;
GArray connecting_indices(GVariant(int,int));

//vector<vector<pair<int, int> > > points;
GArray points(GArray(GVariant(int,int)));
1

There are 1 answers

0
fiorentinoing On

If the target is C, then gcc is the right compiler to use. The only fact that the code compiles, says nothing about correctness, though. Maybe You missed a GVariant in the first row, or the definition is inconsistent. For clearness I would define points as GArray of connecting_indices, don't you? Anyway this doesn't look working C-code.