The proposal for shared_ptr<T[N]>
has this paragraph:
https://www.open-std.org/JTC1/SC22/WG21/docs/papers/2014/n3920.html
The unfortunate occurence of unique_ptr having lost its support for U[N] obliges me to assert that in shared_ptr case, said support is essentially free, both in terms of implementation complexity or specification complexity. Please don’t remove it. Consider reinstating unique_ptr<U[N]> instead.
Is it simply a case of ‘no-one has since proposed to restore unique_ptr<T[N]>
‘, or is there some technical or backwards compatibility reason it can’t be done?
I looked at these two existing questions:
- Why is `make_unique<T[N]>` disallowed?
- Why allow shared_ptr<T[N]>?
The first question was written pre-shared_ptr<T[N]>
, and the second considers why shared_ptr<T[N]>
was added but not why it wasn’t also added to unique_ptr
.