This answer cites N4082, which shows that the upcoming changes to std::shared_ptr
will allow both T[]
and T[N]
variants:
Unless I'm mistaken, a
Y(*)[N]
could only be formed by taking the address of an array, which clearly can't be owned or deleted by ashared_ptr
.
Don't forget that shared_ptr
is a generic resource management utility and can be constructed with a custom deallocator:
template shared_ptr(Y* p, D d);
Such a user-provided deallocator can perform an action other than delete
/delete[]
. For example if the the array under question is an array of file descriptors, the "deallocator" can just close all of them.
In such cases the shared_ptr
doesn't own the object in the widely used sense and therefore can be bound to an existing array by taking its address.