[pygccxml-development] virtual functions without wrappers
Brought to you by:
mbaas,
roman_yakovenko
|
From: Neal B. <ndb...@gm...> - 2006-08-24 16:38:27
|
I am playing with pyplusplus, trying out pypp_api. I noticed that a class
with virtual functions and inheritance used wrappers, as shown in the
boost::python tutorial.
I would like to have to option to bypass these wrappers. IIUC, wrappers are
only needed if the function will be overidden in python and then called from
c++. My intention is a class hierarchy implemented in c++ only that is
called from python.
Here is a typical example:
struct base { virtual void F() = 0; };
struct impl_1 : base { virtual void F() { do something; } };
struct X {
X (boost::shared_ptr<base> _p) : p (_p) {}
boost::shared_ptr<base> p;
void use_F () { (*p)->F(); }
};
In python then:
i = impl_1()
x = X (i)
x.use_F()
|