Post-constructor action
Hi, Anybody knows how do I get the Python object of a newly created object of a Boost.Python extension class object, just after the call of the constructor, before the pointer return to Python? I was thinking how to do it, but I am a bit confused. I suppose those I could use customized call policies, but I am not sure neither know how to do it. Another thing that I saw interesting is this "make_constructor" function. I could use factory functions, but I'll loose my Python constructor. Does anybody have any idea of how to deal with it? Thanks, [Eric Jardim]
Eric Jardim <ericjardim@gmail.com> writes:
Hi,
Anybody knows how do I get the Python object of a newly created object of a Boost.Python extension class object, just after the call of the constructor, before the pointer return to Python?
Your best bet? Use old-style polymorphism support: struct WrappedFoo : Foo { WrappedFoo(PyObject* self, <arguments to Foo's ctor here>) { } }; class_<Foo,WrappedFoo>("Foo") ... ;
I was thinking how to do it, but I am a bit confused. I suppose those I could use customized call policies, but I am not sure neither know how to do it.
Me neither ;-)
Another thing that I saw interesting is this "make_constructor" function.
You could, but that would be the complicated approach. HTH, -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (2)
-
David Abrahams -
Eric Jardim