I was using heap memory as part of a small example, and I ended up writing this:
double* p = new double[4] { 0.0, 1.0, 2.0, 3.0 };
...
delete[] p;
Later, I wanted to upgrade this to a std::unique_ptr:
std::unique_ptr<double[]> arrp(new double[4] { 0.0, 1.0, 2.0, 3.0 });
...
(no need for delete[]).
Of course, it is always better to use std::make_unique rather than new, but how can initialize an array of elements with std::make_unique?
To answer my own question, here is a bad, no-good, inefficient implementation that I do not necessarily want to use.
At best it would clarify what I want in the question.
https://godbolt.org/z/d11h8WhEo