Questions tagged [make-shared]

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

138 questions
-2
votes
1 answer

Please help me to understand boost::make_shared

I am self-learning C++ and have got a piece of C++ code which reads like: boost::make_shared >() I failed to comprehend what the above line is doing and why it may be required. What would be an alternative way to achieve…
Daniel
  • 121
  • 6
-2
votes
1 answer

Giving up ownership of a memory without releasing it by shared_ptr

Is there a way I can make the shared pointer point to a different memory location without releasing the memory.pointed by it currently Please consider the code: #include #include #include…
gudge
  • 1,053
  • 4
  • 18
  • 33
-7
votes
1 answer

Does std::make_shared(new Foo()) create singletons?

When std::make_shared(new Foo()) is called, it constructs a Foo and returns a std::shared_ptr for the caller (viz. here). If this is called multiple times from various objects, does it construct a new Foo() each time? In this case is it no…
Danny A
  • 323
  • 1
  • 4
  • 14
1 2 3
9
10