From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-12-10 18:59:42


Phil Endecott wrote:
> Dear Boost experts,
>
> I have a C library that returns pointers to structs, and has special
> free functions that I must call to finalise and free these structs. Is
> there any way that I can create a shared_ptr that will call this
> special library free function when the last copy is destroyed?

Yes, there is:

shared_ptr< blob > pb( create_blob(), free_blob );