Hmm, well if the arg definition matters like you two are suggesting it does, then maybe the python code from Py++ does work.
Right now it generates code that I use, but I do not include the bp::object, so my function in boost python looks like int (Foo::*bar1)( const Y*) = &Foo::bar; int (Foo::*bar2)(const X&, const Y*) = &Foo::bar; ... .def( "bar", bar1 ) .def( "bar", bar2 ) That requires python to supply Y* but if I understand what you two are saying .def( "bar", bar1, ( bp::arg("Y") = bp::object() ) ) .def( "bar", bar2, ( bp::arg("X"), bp::arg(Y) = bp::object() ) ) would make python not require that default arg. If that is the case then i guess all is well. When I saw Py++ generate that I figured bp::object() was just some weird thing I did not have to worry about. the documentation page I have been using and could not find an example of member function default params is here http://www.boost.org/doc/libs/1_41_0/libs/python/doc/tutorial/doc/html/python/functions.html#python.default_arguments perhaps it would be nice to note this very handy bp::object somewhere. Thanks On Tue, Jan 12, 2010 at 2:09 PM, Hans Meine <hans_me...@gmx.net> wrote: > On Dienstag 12 Januar 2010, Charles Solar wrote: > > Well I want to define the overloads myself anyway, I just do not know how > > to properly setup the small wrapper that will work. > > Oh, OK. > > > In the doc it tells > > you how to make flat function wrappers, but nothing on member function > > wrappers. > > I am 100% sure that they're documented, yet I am not very lucky with the > docs > either. > > > I am unsure how I am supposed to handle the this pointer, for > > example. > > You can reference the member function pointer like this (untested of > course): > > .def("bar", (void(Foo::*)(const Y*))&T::bar) > .def("bar", (void(Foo::*)(const X&,const Y*))&T::bar) > > > So idealy what I would like to know is what the macro does so I can > > manually write out the wrappers myself. > > > > And I have tried using Py++, it does not handle the default argument, it > > just puts the call in there and python still requires the param to be > > there. > > Really? AFAIK, it should work. > > You should be able to write (arg("some_x"), arg("some_y") = NULL)) as > extra .def() argument. > > Maybe py++ does not output the default args when the arguments are unnamed? > (I wouldn't know how, either.) > > -- > Ciao, / / .o. > /--/ ..o > / / ANS ooo > > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig >
_______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig