C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Delete...why not a parameter by reference?!

From: Bo Persson <bo_at_[hidden]>
Date: Sat, 23 Aug 2025 07:55:23 +0200
On 2025-08-23 at 07:25, organicoman via Std-Proposals wrote:
>
> Let's forget the passing by reference thing....just focus on the delete
> operator which nullify it's pointer parameter. I don't see why it is not
> the standard..
>

The direct answer to "why is it not a reference" is the same as for why
we have "*this" - these features were added to the language early, long
before we even had references.

C++ has a long history of not removing existing parts of the language,
but instead add new alternatives. This is one of those cases - delete
uses a pointer, because it always has.

Received on 2025-08-23 05:55:28