Top "Make-shared" questions

make_shared is a function for creating shared pointers introduced in C++11.

Is make_shared really more efficient than new?

I was experimenting with shared_ptr and make_shared from C++11 and programmed a little toy example to see what …

c++ shared-ptr clang libc++ make-shared
Can you allocate an array with something equivalent to make_shared?

buffer = new char[64]; buffer = std::make_shared<char>(char[64]); ??? Can you allocate memory to an array using make_…

c++ c++11 shared-ptr make-shared
How to pass deleter to make_shared?

Since C++11, because of several reasons, developers tend to use smart pointer classes for dynamic lifetime objects. And with those …

c++ c++11 shared-ptr smart-pointers make-shared
Initializing shared_ptr member variable, new vs make_shared?

When initializing a shared_ptr member variable: // .h class Customer { public: Customer(); private: std::shared_ptr<OtherClass> something_; } // .…

c++ c++11 shared-ptr initializer make-shared
Errors in std::make_shared() when trying to make shared_ptr?

(Using Visual Studio 2010) I'm trying to create a shared_ptr of an existing class in my project (class was written …

c++ c++11 shared-ptr visual-c++-2010 make-shared
std::make_shared number of parameters in the constructor

In the absence of variadic templates (still!) in Visual Studio 2010/2011, a constructor that takes a lot of parameters can be …

c++ stl make-shared
How to make boost::make_shared a friend of my class

I have written a class with protected constructor, so that new instances can only be produced with a static create() …

c++ templates boost friend make-shared
C++11 Passing 'this' as paramenter for std::make_shared

I'm trying to pass 'this' to the constructor using std::make_shared Example: // headers class A { public: std::shared_ptr&…

c++ constructor c++11 this make-shared