1

In the following code example, does the destructor of the shared pointer delete the object that's been destructed defined by new?

auto object = std::shared_ptr<Foo>(new Foo());

I found this in some legacy code and I'm wondering if this causes memleaks or not.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
marijnr
  • 121
  • 3

0 Answers0