logo       

Re: set_wrapper: msg#00292

python.c++

Subject: Re: set_wrapper

Giulio Eulisse wrote:

If I have a simple class

class A {}

and a function
void f_A(void){...}

pyste's set_wrapper(A.f,"f_A") should, IMHO, generate

class_< A >("A", init< >())
.def(init< const A & >())
.def("f", &f_A)
;
even if A::f() is not present. Is there a reason why it doesn't?

Thanks in advance,
Giulio


Yeah, it doesn't have support to add methods to classes yet... I will look into it. You find the "set_wrapper" syntax good enough for this purpose, or perhaps an "add_method(name, func)" would be better?

Note also that the method you are trying to add must receive as first argument a reference or a pointer to the class, so your f_A function should be:

void f_A(A&);

Regards,
Nicodemus.


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise