简体   繁体   English

C ++ STL容器到Glib的转换

[英]C++ STL containters to Glib conversion

I am trying to convert C++ code with STL containers to C and Glib. 我正在尝试将带有STL容器的C ++代码转换为C和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)));

If the target is C, then gcc is the right compiler to use. 如果目标是C,则gcc是要使用的正确编译器。 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. 也许您错过了第一行的GVariant,或者定义不一致。 For clearness I would define points as GArray of connecting_indices , don't you? 为了清楚起见,我将points定义为connecting_indices GArray ,不是吗? Anyway this doesn't look working C-code. 无论如何,这看起来不起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM