...
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 | ||||
|---|---|---|---|---|
| ||||
#include <memory>
struct S {};
void f() {
std::unique_ptr<S[]> s = std::make_unique<S[]>(10);
} |
...