Boost logo

Boost Users :

Subject: Re: [Boost-users] non nullable smart pointers
From: Emil Dotchevski (emil_at_[hidden])
Date: 2008-11-15 03:05:27


On Fri, Nov 14, 2008 at 8:20 PM, Brendan Miller <catphive_at_[hidden]> wrote:
> On Fri, Nov 14, 2008 at 7:23 PM, Emil Dotchevski
>> On Fri, Nov 14, 2008 at 6:16 PM, Brendan Miller <catphive_at_[hidden]> wrote:
>>> I'm also aware of a number of problems with the shared_ptr
>>> implementation, specifically that it creates a second allocation for
>>> the counter (the counted body problem)
>>
>> Using make_shared avoids the separate allocation for the control block.
>
> I don't see a make_shared anywhere in the boost shared_ptr documentation...
> http://www.boost.org/doc/libs/1_36_0/libs/smart_ptr/shared_ptr.htm
> Am I looking in the wrong place?
>
> Yeah, I was wondering why someone hadn't done something like this...
> but I don't see it documented anywhere. Also, is this in TR1/C++0x's
> shared_ptr? I've never seen a reference to it anywhere.

I'm not sure about documentation but make_shared is available in
Boost: http://svn.boost.org/svn/boost/trunk/boost/make_shared.hpp

Also see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2351.htm
and Peter Dimov's web site http://www.pdimov.com/ for more shared_ptr
info.

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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net