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:01:40 +0100
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 youdon't want the library to delete it, and there's teamworkbetween 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.

Received on 2025-08-24 21:01:49