Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In this compliant solution, the std::unique_ptr is declared to hold an array of objects instead of a pointer to an object. Additionally, std::make_unique() is used to initialized initialize the smart pointer.

Code Block
bgColor#ccccff
langcpp
#include <memory>

struct S {};

void f() {
  std::unique_ptr<S[]> s = std::make_unique<S[]>(10);
}

...