C++ Logo

std-proposals

Advanced search

Re: [std-proposals] promote T[] and deprecate delete[]

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Wed, 2 Jul 2025 18:25:34 +0100
On Wed, 2 Jul 2025 at 17:06, David Brown via Std-Proposals <
std-proposals_at_[hidden]> wrote:

>
> It turns out my suggestion was already covered by std::unique_ptr<T[]>.
> (I imagine that my idea could have lower overheads, but that's possibly
> just because I haven't thought through the details for more complex
> cases. And std::unique_ptr<T[]> has the big advantage of already
> existing - a few extra bytes overhead is unlikely to be significant in
> real code.)
>

I don't think there's any overhead. sizeof(unique_ptr<T[]>) == sizeof(T*)
and it just stores a pointer to an array allocated with new[].

Received on 2025-07-02 17:25:50