Using Boost/Python, how does one overload methods? For instance:
struct Bar { void func( const std::string& s ); void func( int i ); };
BOOST_PYTHON_MODULE( Foo ) { class_<Bar>( "Bar" ) .def( "func", &Bar::func ) .def( ??? ) ; }
The reference documentation discusses the BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS macro, but it only seems to apply to methods with default arguments.
--bruce
I should have scanned the python c++ SIG first. Also now realize that python.boost questions are preferred on that list rather than here. For future newbie reference, solution to above appears to be: struct Bar { void func( const std::string& s ); void func( int i ); }; BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS( Bar_func_overloads, Bar::func, 1, 1 ) BOOST_PYTHON_MODULE( Foo ) { class_<Bar>( "Bar" ) .def("func",(void(Bar::*)(const std::string&))0,Bar_func_overloads) .def("func",(void(Bar::*)(int))0,Bar_func_overloads) ; } --bruce