[Solved] Does std::make_shared(new Foo()) create singletons?


No, std::make_shared<Foo>() will always create a new Foo object and return the managed pointer to it.

The difference to unique_ptr is, that you can have multiple references to your pointer, while unique_ptr has only one living reference to your object.

auto x = std::make_shared<Foo>();
auto y = x; // y and x point to the same Foo
auto x1 = std::make_unique<Foo>();
auto y1 = x1; // Does not work

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