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: Thu, 23 Oct 2025 08:56:29 -0700
On Wednesday, 22 October 2025 21:56:16 Pacific Daylight Time Simon Schröder via
Std-Proposals wrote:
> The initial example was motivated by std::mutex which neither copyable nor
> movable.

For a good reason. It's one type that cannot survive the trick that Frederick
suggested, because its constructors and destructors may access a global list
of other mutexes.

So please stop using it as an example for this particular need. Find other
types.

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

Received on 2025-10-23 15:56:40