Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-04-12 20:53:56


Daniel Frey:
> On Sat, 2008-04-12 at 21:37 +0300, Peter Dimov wrote:
>> http://svn.boost.org/trac/boost/changeset/44353
>
> This introduces overhead to both ctors which take a deleter, they are
> now calling get_deleter in order to pass it to sp_accept_owner.

Yes, it does. This is an implementation artifact. The Overhead(tm) can
easily (if not particularly elegantly) be avoided by piercing the
shared_count abstraction a bit, if one gets motivated enough by an extra
virtual call.

> This is IMHO not needed, the called sp_accept_owner can call get_deleter
> on the shared_ptr itself.
>
> If passing the type of the deleter itself is really needed, it can be done
> without overhead, e.g. pass (D*)0.

This would be letting the implementation drive the interface. Not a good
idea in general, unless the interface is inherently inefficient. It isn't.


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