C++ Logo

std-proposals

Advanced search

Re: [std-proposals] A new C++ keyword: forget

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Wed, 12 Aug 2026 17:21:27 +0300
On Wed, 12 Aug 2026 at 17:05, Tiago Freire via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> For me I would mostly be interested in the const case.
> Example in an awkward initialization scenario, where a variable should be const (for const hygiene) but can't because of conditions.
> But I can also see full erasure being useful in the case of scopes locks if you need them to exist but should not be messed with unless by trivial behavior when going out of scope.
> Although I have to admit that the full erasure has little applications.

Thanks, good point,

4) poisoning a variable after a construction-laterassignment pair, so
it can't be const, and can't be declared unnameable,
but should be unnameable after it has been both created and
post-creation set up to guard a scope

Received on 2026-08-12 14:21:46