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:03:18 -0700
On Thursday, 23 October 2025 21:44:22 Pacific Daylight Time Simon Schröder via
Std-Proposals wrote:
> > 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.
>
> So, this means that currently we are only talking about movable and copyable
> types? In that case the standard does not have to prescribe any tricks of
> how to implement such functionality (but implementations could still use
> it).

I don't know. Can we find other non-movable, non-copyable types that could be
emplaced in an optional or optional-like container? And where replacing it is
also an expected use-case?

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

Received on 2025-10-24 13:03:29