C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Idea: moved_from<T>() for Efficient Moved-From State Construction

From: Thiago Macieira <thiago_at_[hidden]>
Date: Thu, 24 Apr 2025 11:42:24 -0700
On Thursday, 24 April 2025 11:37:11 Pacific Daylight Time Robin Savonen
Söderholm wrote:
> I'd like to take a slightly different angle to this and that is
> [[indeterminate]]: having a way to tell the compiler how it should do with
> an instance of a user-defined type (or array of such) that is marked with
> that attribute could both be useful and not possible to do within the
> current standard AFAIK.
>
> Just my 2c.

That might be useful, but I'd then expect a core language change that would
call a user-specified constructor to create the indeterminate state. In my
experience, it's far safer for the default constructor to create the safe
state and to provide "fast I know what I'm doing" case as an extra, like
resize_for_overwrite().

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2025-04-24 18:42:26