C++ Logo

std-proposals

Advanced search

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

From: organicoman <organicoman_at_[hidden]>
Date: Sun, 24 Aug 2025 22:44:46 +0100
> 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 madeworse with such nonsense.Dear Ville, don't be upset , we all do mistakes.That facility is in C++26, It's 2025 now " make me live today, kill me tomorrow " or so they say.which means it'll be in the hands of usersmuch earlier than any hypothetical changethat would make delete null a pointer.

Received on 2025-08-24 21:44:59