1 std::unique_ptr< Test[] > upt(std::make_unique< Test[] >(2));
//No leak here, as it does reset, which will deallocate.
3 upt = (std::make_unique< Test[] >(1));
In the above snippet, on call to line 3, twice destructors of Test gets called, and allocates memory for array of size 1,
So, who call the reset? Is it make_unique
does it?
Also, can I get detail implementation of make_unique
and make_shared
.