We know that Resource Acquisition is Initialization (RAII), I looked for the syntax to initialize an array of objects that have parameters (with no default params), managed by unique_ptr but I did not find any example, there is one in Cppreference constructing int
int size = 10;
std::unique_ptr<int[]> fact(new int[size]);
How could I write like this:
class Widget
{
Widget(int x, in y):x_(x),y_(y)
{}
int x_,y_;
};
std::unique_ptr<Widget[]> fact(new Widget[size]);