C++ Logo

std-proposals

Advanced search

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

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Fri, 24 Oct 2025 13:12:06 +0200
You don't know the reason the object is unmovable. The address space of the object may be mapped to the hardware. Copying and restoring may lead to errors.   Simple example: A DMA buffer.   -----Ursprüngliche Nachricht----- Von:Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden]> Gesendet:Fr 24.10.2025 11:43 Betreff:Re: [std-proposals] Replace an object -- but retain old object if new object fails to construct An:std-proposals_at_[hidden]; CC:Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>; On Friday, October 24, 2025, Simon Schröder via Std-Proposals <std-proposals_at_[hidden] <mailto: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>.      -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2025-10-24 11:25:09