[C++-sig] Pointer ownership

Tim Spens t_spens at yahoo.com
Mon Aug 6 21:46:24 CEST 2007

>From searching around it looks like I need to use
return_value_policy<manage_new_object>() so that I can
manage the deletion of the new object.

How can I add this to my class z_command?

--- Tim Spens <t_spens at yahoo.com> wrote:

> I have a constructor that takes a pointer as an
> argument.  When I create an instance of this class
> and
> the object looses scope in python I get an error
> glibc detected python: free(): invalid pointer:
> The class wrapper looks like this
> class_<z_command, bases<command>,
> boost::noncopyable>("z_command", init<std::string
> const &, p *>());
> Do I need a call policy for this pointer?  I've
> looked
> at the boost python call policies and found nothing
> for constructors with pointers as arguments.

Got a little couch potato? 
Check out fun summer activities for kids.

More information about the Cplusplus-sig mailing list