C++ Logo

std-proposals

Advanced search

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

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Tue, 28 Nov 2023 15:04:06 -0500
On Tue, Nov 28, 2023 at 10:00 AM Frederick Virchanza Gotham via
Std-Proposals <std-proposals_at_[hidden]> 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.

OK: why do you think that? Why is it a good idea to make it easy to
subvert the object model and trivially terminate an object without
invoking its destructor?

And if this functionality is so important, why not make it easier to
do in the language than through an `optional`-specific interface?

Can you provide a justification beyond the fact that you found it to
be useful in your specific use scenarios?

Received on 2023-11-28 20:04:26