C++ Logo

std-proposals

Advanced search

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

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Fri, 24 Oct 2025 09:43:26 +0000
On Friday, October 24, 2025, Simon Schröder via Std-Proposals <
std-proposals_at_[hidden]> wrote:

>
>
> So, this means that currently we are only talking about movable and
> copyable types?
>



We can use the "put object in temporary cryostasis" technique on an
unmoveable-and-uncopyable type so long as the constructors and destructors
of the type don't access other objects of the same type.

The problem with 'mutex' is that, on some platforms, its constructor
accesses some sort of global directory (linked list?) of other mutexes.

A better example might have been lock_guard<mutex>.

Received on 2025-10-24 09:43:29