I want to export into python module (written in c++, with boost.python library) such function:
Vec2<Type> &normalize ()
Type dot(const Vec2<Type> &vector) const
These are the members of template class Vec2. Here is my export code:
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 method compiles successful, but Dot and Normalize returns same mistake (during compiling):
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<>)’
What I did wrong?
UPD
The real class name is: CL_Vec<Type>, here is the docs.
If you look at
vec2.h(or the docs you link to), you’ll see thatdotandnormalizeare both overloaded, since there also existstaticversions of these.You can get around this by using a few function pointers:
and then using that in the
def, as explained here.