欲導出到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。
由於這些顯然是成員函數,請顯示整個類的定義。 – 2011-03-20 14:47:21
是否有額外的'dot'超負荷,您沒有向我們展示? – 2011-03-20 14:52:07
@larsmans @ john-zwinck我已添加到帖子中。 – Ockonal 2011-03-20 14:54:38