C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Replace an object -- but retain old object if new object fails to construct

From: Thiago Macieira <thiago_at_[hidden]>
Date: Fri, 24 Oct 2025 06:53:38 -0700
On Friday, 24 October 2025 06:25:27 Pacific Daylight Time Sebastian Wittmeier
via Std-Proposals wrote:
> The difficulty is not knowing, whether construction works.
>
> Otherwise the old object can be destructed first and the new one
> constructed.
>
>
> To abstract this more, it is like a failing transaction, which can be rolled
> back.

I think that's an even more important question: how often do we need this
replacement solution whereby the previously-stored object is present if the
new one throws on construction?

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center Group

Received on 2025-10-24 13:53:44