boost.python overloading to_python
hi,
please consider the following example
class A {
public:
A() {}
A(const A& a) {}
};
class A2 : public A {
public:
A2() : A() {}
A2(const A2& a2) : A(a2) {}
};
class B {
public:
const A& getA(); //returns refs to A or A2
};
now, when exposing this in boost, i would always get A's when
calling B::getA() from python, which i understand, since AFAIK
the copy Ctors are used to instantiate the python object.
to overcome this i wrote:
PyObject *to_python(const A &a) {
if (dynamic_cast
participants (1)
-
dkottowk