Hi all,

This may be an FAQ, but if so I haven't seen it in the FAQs (on the wiki and in the docs).

Say I have this:

class A {};

class B
{
  public:
    A* getA();
    const A* getA() const;
};

If I just add .def("getA", &B::getA, some_return_policy) to my class_ wrapper, on compile it will complain that it doesn't know which version of B::getA() I want. Up until now the way I wrapped this was to make a trivial wrapper function:

A* (B::*B_getA1)() = &B::getA;

and then used .def("getA", B_getA1, some_return_policy). But as I wrap many classes, I wind up with lost of these trivial wrappers at the top of my source files, they're hard to read when skimming and just plain look bad. Is there some template or preprocessor magic I could use to generate these automatically, or even better, to allow me to specify in the .def() which version I want?

Thanks in advance,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to