Does anyone know why the following sample fails (it was adapted from
the boost overloading example) and how to do this correctly. Thanks in
advance.
#include
#include
#include
#include
#include
#include
#include
using namespace boost::python;
struct X
{
int f(int x, double y = 4.25, char const* z = "wow")
{
return x;
}
int f(int x, bool b = true) {
return x;
}
};
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_member_overloads, X::f, 1, 3)
BOOST_PYTHON_MODULE(args_ext)
{
class_<X>("X", "This is X's docstring")
.def("f1", &X::f,
f_member_overloads(args("x", "y", "z"), "f's docstring"
)[return_internal_reference<>()]
)
;
}
g++ -fpic -shared -o test.so test.cpp -lpython2.4 -lboost_python
-I/usr/include/python2.4
test.cpp: In function ‘void init_module_args_ext()’:
test.cpp:31: error: no matching function for call to
‘boost::python::class_::def(const char [3], <unresolved
overloaded function type>,
boost::python::detail::overloads_proxy, f_member_overloads>)’