擅长:python、mysql、java
<p>你需要告诉SWIG你想要一个向量字符串类型映射。它不会神奇地猜测所有可能存在的不同向量类型。</p>
<p>这是Scholli提供的链接:</p>
<pre><code>//To wrap with SWIG, you might write the following:
%module example
%{
#include "example.h"
%}
%include "std_vector.i"
%include "std_string.i"
// Instantiate templates used by example
namespace std {
%template(IntVector) vector<int>;
%template(DoubleVector) vector<double>;
%template(StringVector) vector<string>;
%template(ConstCharVector) vector<const char*>;
}
// Include the header file with above prototypes
%include "example.h"
</code></pre>