[C++-sig] Member function bp::optional? Or workaround?

Hans Meine hans_meine at gmx.net
Tue Jan 12 21:09:39 CET 2010

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 

> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20100112/ad3aa351/attachment.pgp>

More information about the Cplusplus-sig mailing list