Re: [Boost-users] shared_ptr with custom free function

-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Peter Dimov Sent: Sunday, December 10, 2006 7:00 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] shared_ptr with custom free function
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 );
[Nat] It might be worth binding that knowledge into a specific shared-pointer-to-blob type so that the required deleter function is implicitly captured EVERY time you construct such a pointer.

From: boost-users-bounces@lists.boost.org on behalf of Nat Goodspeed [Nat] It might be worth binding that knowledge into a specific shared-pointer-to-blob type so that the required deleter function is implicitly captured EVERY time you construct such a pointer. ------------- How do you encode that knowledge into the type?
participants (2)
-
Nat Goodspeed
-
Sohail Somani