C++ Logo

std-proposals

Advanced search

Re: [std-proposals] void std::optional<T>::abandon(void) noexcept

From: Bjorn Reese <breese_at_[hidden]>
Date: Tue, 28 Nov 2023 16:38:50 +0100
On 11/28/23 15:59, Frederick Virchanza Gotham via Std-Proposals wrote:

> But this isn't about the one program that I wrote. I think in general
> an 'std::optional' should be able to abandon its object.

Today you need it for std::optional, tomorrow for std::vector or some
other type. Consider writing your own wrapper with an abandon function,
so that (i) you can use it with other standard library types, and (ii)
we do not have extend standard library types with functions to create
resource leaks.

Received on 2023-11-28 15:38:53