|
Boost : |
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2002-05-07 15:05:02
"Greg Colvin" <greg_at_[hidden]> wrote in message
> void com_releaser(IUnknown* p) { p->Release(); }
>
> template<class T> shared_ptr<T>
> make_com_shared_ptr(IUnknown* p) {
> p->AddRef();
> return shared_ptr<T> (p,com_releaser);
> }
We already talked about this. I could(?) be acceptable for COM pointers. But
for generic class with intrusive counter it does not have a sense. There
could be a lot of reasons why one would not want to inherit from
counted_base (performance is for once,existent code is second).
To Peter:
I think that shared_ptr named shared not because you "can use different
deallocators" with the same type (though in some cases it is very
convenient), but because it model some "Idea" of sharing. The way this
sharing is achieved is not important - it still should be shared_ptr. While
the way how pointer/resource is destroyed is secondary in this sense. Why
don't you name you semantic: ptr_with_custom_deleter?
In some cases when we want to emphasize type of sharing in use we may name
smart pointer as intrusive_ptr or ref_linked_ptr. But what in a name? The
real issue for me is to understand: do we need "unified" smart_ptr, why, and
how it should like.
Gennadiy.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk