Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 2000-09-13 15:57:45


From: Thomas Matelich <sosedada_at_[hidden]>
> Greg Colvin wrote:
>
> > We've been considering an improvement to shared_ptr to
> > add template constructors parameterized on a function
> > or functor that does the deletion. We can arrange it
> > so that type of shared_ptr(T*) is the same as the type
> > of shared_ptr(T*,deleter), which might provide for the
> > sort of polymorphism Thomas wants. I'll take this
> > thread as motivation to write the idea up in more
> > detail.
>
> For my purposes (simplifying things for my users), I need both templated
> constructers and deleters. Essentially, I want to hide all use of dynamic
> allocation and deallocation. I've been working on a class to do this. I just
> started with shared_ptr and went from there. I'll paste the code in and then
> describe my problems afterward

I can't tell from your code how you intend for it to be used.
I also don't know what you mean by "templated constructors",
as your Newer trick is used only in shared_resource::reset().

The usual way to hide allocation is with a factory function,
which it seems in your case could return a shared_ptr, but I'm
still not clear on what problem you are trying to solve.


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