C++ Logo

std-proposals

Advanced search

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

From: Robin Savonen Söderholm <robinsavonensoderholm_at_[hidden]>
Date: Thu, 24 Apr 2025 20:37:11 +0200
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.

// Robin

On Thu, Apr 24, 2025, 20:32 Thiago Macieira via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On Thursday, 24 April 2025 09:45:16 Pacific Daylight Time Jonathan Wakely
> via
> Std-Proposals wrote:
> > The ViewPort example is just dumb, nothing says he can't implement the
> > cheap move. He offers two bad choices, and misses the obvious good
> > solution. All you need is a ViewPort::valid() member that is false
> > after being moved-from and then say valid() is a precondition for the
> > other operations on it. What's so hard about that? There are **no
> > performance implications**. Nothing says you need to ever test that
> > valid() member anywhere in the other operations, because it's just a
> > precondition that the caller is required to ensure is met.
>
> Note the precondition is there whether valid() exists or not.
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Principal Engineer - Intel DCAI Platform & System Engineering
>
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

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