C++ Logo

std-proposals

Advanced search

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

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Mon, 25 Aug 2025 00:35:33 +0300
On Mon, 25 Aug 2025 at 00:01, organicoman <organicoman_at_[hidden]> wrote:

> On Sun, 24 Aug 2025 at 22:20, organicoman via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> > It's a team work, with this proposal, we help library implementers to catch bugs.
>
> Right. You want to pass a library a non-copy that's nullable and you
> don't want the library to delete it, and there's teamwork
> between you and the library.
>
> Pass that library a std::optional<T&> instead of a T*.
>
> Unfortunately std::optional doesn't accept references....it's a compilation error.

This whole discussion thread is a colossal waste of time, and made
worse with such nonsense.
That facility is in C++26, which means it'll be in the hands of users
much earlier than any hypothetical change
that would make delete null a pointer.

Received on 2025-08-24 21:35:47