[C++-sig] variable argument number and BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS

William Ladwig wladwig at wdtinc.com
Thu May 21 23:32:08 CEST 2009

It's making a NULL pointer to a member function of A with an integer argument and a void return type.  

I'm not sure what's going on under the hood with why the NULL is required, but I suspect that it has something to do with the fact that 

void info();
void info(int i);

require two function pointers, but 

void info(int i=0) 

can only use one function pointer.  I suspect that they're trying to handle both cases with the same interface.  I'm just guessing though, so I could be wrong about this.


-----Original Message-----
From: cplusplus-sig-bounces+wladwig=wdtinc.com at python.org [mailto:cplusplus-sig-bounces+wladwig=wdtinc.com at python.org] On Behalf Of Hans Roessler
Sent: Thursday, May 21, 2009 4:00 PM
To: Development of Python/C++ integration
Subject: Re: [C++-sig] variable argument number and BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS

Thanks, ".def("info", (void(A::*)(int))0, A_info_overloads());" does it.

Could somebody explain what the meaning of this "(void(A::*)(int))0" construct is? Is it a function pointer? Why the 0?
(Just now I am fine with the proposed solution, but if I even understand it, you will read fewer stupid question from me in this list ;-)


----- Ursprüngliche Mail ----
> Von: William Ladwig <wladwig at wdtinc.com>
> An: Development of Python/C++ integration <cplusplus-sig at python.org>
> Gesendet: Donnerstag, den 21. Mai 2009, 18:30:46 Uhr
> Betreff: Re: [C++-sig] variable argument number and BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS
> I haven't tried this myself, but I think all you need to do to wrap the member 
> function is this:
> .def("info", (void(A::*)(int))0, A_info_overloads());
> Hope this helps,
> Bill

Cplusplus-sig mailing list
Cplusplus-sig at python.org

More information about the Cplusplus-sig mailing list