From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-09-02 10:32:24
----- Original Message -----
From: "Greg Colvin" <gcolvin_at_[hidden]>
> There is a constructor like this
> template<typename Deleter> shared_ptr(T * p, Deleter d): px(p), pn(p, d)
I'll look, but I'm guessing I need much more customization than it provides.
The intrusive reference count is probably the main thing.
> > BTW, I also think that most of these bugs come from shared_ptr
> > not reset. And there's nothing we can do in the construction case. :(
> We could define
> template<typename T, typename Arg1 ...> shared_ptr(Arg1 arg1 ...)
> to be equivalent to
> shared_ptr(new T(arg1 ...))
> though without any varargs syntax for templates we would need to
> provide some number of separate definitions.
That seems to be the "family of function templates" idea I proposed some
time ago. If you are willing to do that, then you can avoid allocating a
separate reference count for cases when you don't need to support adoption
from auto_ptr. Now maybe you can see why I want more customizability.
Also, in this case there's the problem of the single-argument constructor.
What if T has a constructor like this one:
Now how do you construct a shared_ptr<T>? Hint: what does the copy
constructor of shared_ptr look like?
> But I'm not sure I like this idea.
I still like it, though I think we should use a family of free function
templates, which would solve the above problem.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk