我想使用 SWIG 将 vector 的 C++ vector 包装为 Python 代码。
是否可以包装这种类型的 vector ?
std::vector<std::vector<MyClass*>>;
在接口(interface)文件MyApplication.i
中,我添加了这些行:
%include "std_vector.i"
%{
#include <vector>
%}
namespace std {
%template(VectorOfStructVector) vector<vector<MyClass*>>;
}
但是,执行 SWIG 时出现错误。我能够包装这种类型(使用对 vector 的引用):
std::vector<std::vector<MyClass*>*>;
但是,它无法正常工作,我无法访问这些项目。这就是为什么我对这种类型感兴趣(没有引用):
std::vector<std::vector<MyClass*>>;
有什么想法吗?
最佳答案
这是一个C++解析问题吗?
std::vector<std::vector<MyClass*> >;
---Important space---------------^
关于c++ - 包装 std::vector 的 std::vector,C++ SWIG Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3761861/