[C++-sig] set_wrapper

Nicodemus nicodemus at globalite.com.br
Wed May 28 04:16:58 CEST 2003


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.





More information about the Cplusplus-sig mailing list