
On Fri, Nov 14, 2008 at 8:20 PM, Brendan Miller
On Fri, Nov 14, 2008 at 7:23 PM, Emil Dotchevski
On Fri, Nov 14, 2008 at 6:16 PM, Brendan Miller
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