[C++-sig] Post-constructor action

David Abrahams dave at boost-consulting.com
Mon Aug 15 04:52:10 CEST 2005

Eric Jardim <ericjardim at 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>)



> 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.


Dave Abrahams
Boost Consulting

More information about the Cplusplus-sig mailing list