Assume exist some class Foo with two overloaded methods:
class Foo
{
...
void m1(A& a);
void m1(B& b);
I need expose one of
You can use static_cast
to specify which signature to use. With this method, you do not need to create a named function pointer while also keeping your overload resolution within the context of a single line.
boost::python::class_("Foo")
.def("m1", static_cast(&Foo::m1))
.def("m1", static_cast(&Foo::m1))