【发布时间】:2013-12-23 13:24:56
【问题描述】:
我在 c++ 文件中有一个带有以下签名的模板函数
template <class T> std::vector<T> function(T);
我想用 Swig 制作一个接口文件来将 main.cpp 包装到 python 文件中。 对于 int float 和 double 类型,我应该如何在 Swig 中包含 Tfunction?
//main.i
%module main
%include "carrays.i"
%array_class(double, doubleArray);
%{
extern template <class T> std::vector<T> Tfunction(T);
%}
extern template <class T> std::vector<T> Tfunction(T);
【问题讨论】:
标签: c++ python-2.7 swig