Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 2001-07-25 10:30:03


From: Peter Dimov <pdimov_at_[hidden]>
> I have uploaded my proposed changes to smart_ptr.hpp in the Files area,
> folder "smart_ptr." In summary, I've split it into four separate headers,
> one per class, and made some changes to shared_ptr that allow its use across
> app/dll boundaries; dynamic_casts are supported, too. [In addition
> shared_ptr will now - as a QoI issue - call the appropriate destructor even
> when it's not virtual; even shared_ptr<void> works.]

Very nice.

If you are feeling inspired there are two other enhancements I have
been working on.

One is to allow for the user to specify a delete function or function
object at construction time, e.g.

    shared_ptr<FILE> file_ptr(fopen(file_name,file_mode),fclose);

I think that now with boost::function this is a small step from
what you have already with your shared_deleter.

More ambitious is to factor out the implementation into a base
class, so that those who want to experiment with different
implementations can do so, while keeping the shared_ptr
interface:

   template<typename T,template class Base=shared_ptr_base>
   class shared_ptr : Base


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk