【发布时间】:2011-03-20 14:42:35
【问题描述】:
我想导出到python模块(用c++编写,带有boost.python库)这样的功能:
Vec2<Type> &normalize ()
Type dot(const Vec2<Type> &vector) const
这些是模板类Vec2 的成员。这是我的导出代码:
bp::class_< Vec2<int> >("Vec2i", bp::init<int, int>())
.def("Length", &Vec2<int>::length)
.def("Dot", &Vec2<int>::dot, bp::return_internal_reference<>());
//.def("Normalize", &Vec2<int>::normalize);
Length 方法编译成功,但Dot 和Normalize 返回相同的错误(编译期间):
error: no matching function for call to ‘boost::python::class_<Vec2<int> >::def(const char [4], <unresolved overloaded function type>, boost::python::return_internal_reference<>)’
我做错了什么?
UPD
真正的类名是:CL_Vec<Type>,这里是docs。
【问题讨论】:
-
由于这些显然是成员函数,请显示整个类定义。
-
是否还有额外的
dot过载而您没有向我们展示? -
@larsmans @john-zwinck 我已添加到帖子中。
标签: c++ python boost reference export