Boost logo

Boost :

Subject: Re: [boost] shared_ptr/shared_count and the cost of use counter allocation
From: Emil Dotchevski (emil_at_[hidden])
Date: 2008-09-08 16:46:57


On Mon, Sep 8, 2008 at 11:04 AM, Hendrik Schober <spamtrap_at_[hidden]> wrote:
> For the proprietary smart pointer this allocation
> can be tweaked by passing allocators as template arguments, while
> 'shared_ptr' seems not to allow this.

In that aspect shared_ptr is better because it allows you to use
custom allocators without affecting the static type of the shared_ptr;
in other words, two shared_ptr<foo> objects have the same type
(shared_ptr<foo>) regardless whether they've been allocated with the
default allocator or not. This makes it possible to create shared_ptr
factories which pick the best allocation strategy *per instance*
without affecting user code.

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


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