我想通過使用SWIG將向量的C++向量包裝到Python代碼中。包裝std ::向量,向量,C++ SWIG Python
是否可以包裝這種類型的矢量向量?
std::vector<std::vector<MyClass*>>;
在接口文件中MyApplication.i
我添加這些行:
%include "std_vector.i"
%{
#include <vector>
%}
namespace std {
%template(VectorOfStructVector) vector<vector<MyClass*>>;
}
但是,執行痛飲時,我得到一個錯誤。我能夠把這個包類型(使用參考向量):
std::vector<std::vector<MyClass*>*>;
但是,它不能正常工作,我無法訪問的項目。這就是爲什麼我對這種類型感興趣(沒有參考):
std::vector<std::vector<MyClass*>>;
任何想法?
如果這確實是C++而不是C++ 0x,請確保在右括號之間包含一個空格。例如'>>'應該是'>>' – 2010-09-21 15:47:47
我在辯論評論或回答... – 2010-09-21 15:49:02
http://stackoverflow.com/questions/3754922/how-to-wrap-ac-vector-of-vector與swig? – 2011-01-03 04:32:15