Somewhere I saw a post about an optimized way of creating a boost shared_ptr so that it allocated the ptr plumbing and the pointee at the same time. I did a SO search but there are a lot of posts on shared_ptr and I could not find it. Can somebody smart please repost it
edit: thanks for answer. extra credit question. Whats the correct (preferred?) idiom for returning a null shared_ptr? ie
FooPtr Func()
{
if(some_bad_thing)
return xxx; // null
}
to me
return FooPtr((Foo*)0);
looks kinda klunky