【发布时间】:2011-05-28 17:51:45
【问题描述】:
我有templated functionconnect:
template<class InstanceClass>
CL_Slot connect (InstanceClass *instance, void(InstanceClass::*function)(Param1, Param2))
它连接来自InstanceClass的一些信号传递函数。
在我的示例中,我想为键盘事件 (KeyDown) 连接一些类。 在 C++ 中我写:
get_signal_object().connect(&SomeClass::func);
但是我必须在 python-script 中使用这个函数并从 c++ 代码中导出(使用 boost.python)。
据我所知,要导出模板,我必须通过任何使用的类型来导出它。但在 python 中,我将传递仅存在于 python-namespace 中的类。
那么,有什么想法可以在 python 中使用模板化的函数吗?
【问题讨论】:
标签: c++ python templates boost export