编辑: 好的,我尝试将我的代码缩减为示例,它似乎在小示例中有效。我尝试从小示例中重建错误。因此,下面显示的示例不包含问题的原因。
我想用 swig 包装一个继承自 Matlab 模板的类。
template<class T>
class Base {
public:
typedef Base<T>* Pointer;
void create(typename ::Base< T >::Pointer src) {
...
};
}
class Derived : public Base<float> {
//overloading because I hide it by overloading with other parameters
// && using isn't working in the tool set.
void create(typename ::Base< float >::Pointer src) {
Base::create(src);
};
}
对于 Derived swig generates 创建了两个重载包装器,一个使用::Base< float >::Pointer,另一个使用::Base< T >::Pointer。 T 未被 float 替换,因此无法编译,因为 T 未知。
你能给我一些建议吗?
最佳答案
也许你(我)让一些使用(using Base::create
)语句,所以 swig 也将它们包含到 Derived,但不为它们解析 Type 参数。
关于c++ - SWIG:从模板继承和函数重载的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33634858/