From: "David Abrahams" <[EMAIL PROTECTED]> > In Boost.Python, I am going to start using custom deleters to enable > me to produce shared_ptr<T> from any Python object which contains a T, > while keeping the Python object alive. I can't believe I didn't think > of this earlier, and I want to thank Peter Dimov for putting me onto > the idea. > > Each such shared_ptr<T> contains a pointer to the owning Python > object, whose identity is associated with that of the T object it > contains. When these shared_ptrs are converted back to Python, I > currently have to build a new Python object around a copy of the > shared_ptr<T>, so that now there are two Python objects using the same > C++ object's "guts". It would be very useful if I could introspect > about the deleter, and find out that it was using my custom deleter, > extract the Python object pointer, and simply return that instead of > building a new Python object. > > Looking at the code, I can see a few ways to hack that functionality > in, but I wonder if we should think about making it part of the public > interface? After all, the deleter is part of the public interface for > shared_ptr creation...
shared_ptr introspection is something that I've been considering lately. In particular: void const * shared_ptr::get_original_pointer() const; std::type_info const & shared_ptr::get_element_type_info() const; I haven't encountered a need to inspect the deleter yet... what interface are you suggesting? _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost