Richard Heck <rgh...@lyx.org> writes: | On 10/21/2012 03:11 PM, Lars Gullik Bjønnes wrote: >> Using std::make_shared (and in our case for the time being >> boost::make_shared) >> is the preferred way of creating a std::shared_ptr. >> | Can we get some kind if mini-tutorial here, then, on how to use this | routine? I see several different ways it's present in this patch.
I thought I did it the same way always? Basically std::make_shared<Type>(Args..) creates runs new Type(Args...) for you. (except that internally it juse placement new to only do one allocation so you get the ref-count allocated for "free") In the patch I sent I use std::make_shared (really boost::make_shared) and assigns the result to a shared_ptr<Type>. shared_ptr<Type> sp = make_shared<Type>(Args..); Can you ask me a more specific question? I am at loss at what/how to tutorialize more. But: http://www.boost.org/doc/libs/1_51_0/libs/smart_ptr/make_shared.html http://en.cppreference.com/w/cpp/memory/shared_ptr/make_shared -- Lgb