C++ Logo

std-proposals

Advanced search

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

From: Bjorn Reese <breese_at_[hidden]>
Date: Thu, 30 Nov 2023 13:15:56 +0100
On 11/30/23 00:25, Frederick Virchanza Gotham via Std-Proposals wrote:

> I think I'll just use this one-liner to abandon the value:
>
> ::new( &myvar.value() ) std::future<bool>();

Why? Dragan has already explained that optional::reset() or reassignment
handles the promise/future shared state correctly.

Received on 2023-11-30 12:16:00