|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-04-03 05:04:31
Lars Gullik Bjønnes wrote:
> We find ourselves in want of a custom deallocator for scoped_ptr, but
> no such thing seems to exist now.
>
> Has this been thought of?
>
> If yes, what was the reason for not supporting this?
If you want a shared_ptr-style runtime custom deallocator support, this is
not supported because the overhead was (and is) considered unacceptable for
scoped_ptr. Use shared_ptr instead.
The alternative is
template< class T, class D = boost::checked_deleter<T> > class scoped_ptr
{
public:
// ...
~scoped_ptr() { D()(ptr); }
};
The concern here is that the change may potentially break user code that
uses a template template parameter to pass
scoped_ptr/auto_ptr/shared_ptr/whatever_ptr as an argument.
I'm not yet sure whether the increased functionality justifies breaking such
code. OTOH I'm not sure whether such code even exists. ;-)
So if someone has an opinion about this potential change to scoped_ptr, now
is probably the right time to express it.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk