Subject: Re: [boost] [shared_ptr] Design question about make_shared
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-06-16 07:37:34
On 16/06/2011 06:43, Stephan T. Lavavej wrote:
> [Peter Dimov]
>> My initial implementation of boost::make_shared was a self-contained header
>> that didn't require any changes to shared_ptr (it would have worked with
>> std::tr1::shared_ptr as well as it worked with boost::shared_ptr). This can
>> only be done with a free function.
> Aha - that's an interesting bit of history!
>> (However, it can be argued
>> that this support - the ability to ask for a deleter of a specific type to
>> be default-constructed in place by shared_ptr - should be offered to users
>> as well, not just to make_shared.)
> I don't look at Boost's implementation, but this makes me curious as to whether you implement the "we know where you live" optimization. On x86, for a 4-byte Foobar, how big is your reference count control block for make_shared<Foobar>()? Mine is 16 bytes.
What's the point? It still need to be padded to 32 for good performance
and to use DWCAS.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk