RE: [Boost-users] shared_ptr<> w/ Boost::Python
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of John Meinel Sent: Saturday, October 30, 2004 9:24 AM To: boost-users@lists.boost.org Subject: [Boost-users] shared_ptr<> w/ Boost::Python
In the boost::python tutorial, they talk about when you return a raw reference or pointer, you need to wrap it to manage lifetime of the object. http://www.boost.org/libs/python/doc/tutorial/doc/call_policies.html
In the beginning of that page, they talk about how smart pointers are better for defining the scope and lifetime of objects, but sometimes raw pointers are necessary. I've gotten pretty good about when to manage_new_object, or return_internal_reference, etc.
However, now that I have changed my return functions to actually return a smart pointer, it doesn't seem like I should need to wrap the return value anymore. Only now, when I try to do a "get" it gives me the error:
" No to_python (by-value) converter found for C++ type: class boost::shared_ptr<class mine> "
I have a converter for "class mine". I actually thought that the lifetime managers were using a shared_ptr, so if I did it myself, it would just be transparent.
[Nat] We tell boost::python the smart pointer type we're using, like
this:
class_
participants (1)
-
Nat Goodspeed