Typically, we can create an array using brace initialization of dynamic allocation by
int* arr = new int[5]{1,1,2,4,5};
But would this be possible using smart pointers, specifically using std::make_unique? I've tried the following:
unique_ptr<int[]> arr(5) {1,1,2,4,5};
unique_ptr<int[]> arr = make_unique<int[]>(5){1,1,2,4,5};
unique_ptr<int[]> arr = make_unique<int[]>({1,1,2,4,5});
But no avail, and I am getting to a point where I think this might not even be possible using smart pointers. Any suggestions on how to go about using brace initialization for smart pointers would be appreciated.
Yes, I am aware of std::vector but was hoping if there was a alternative way.