|
Boost Users : |
From: Nat Goodspeed (ngoodspeed_at_[hidden])
Date: 2006-12-10 20:01:52
> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> bounces_at_[hidden]] On Behalf Of Peter Dimov
> Sent: Sunday, December 10, 2006 7:00 PM
> To: boost-users_at_[hidden]
> 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.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net