C++ Logo

std-proposals

Advanced search

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

From: Jonathan Grant <jgrantonline_at_[hidden]>
Date: Thu, 13 Aug 2026 23:10:30 +0100
On 12/08/2026 15:05, Tiago Freire via Std-Proposals 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.

With compile_assert P4021 it's easy to implement an AddConst, or AddWriteOnly to an object which prevents subsequent lines of code from Writing or Reading. No language change is needed.

Kind regards
Jonathan


> 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.
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> *From:* Std-Proposals <std-proposals-bounces_at_[hidden]> on behalf of Udo Steinbach via Std-Proposals <std-proposals_at_[hidden]>
> *Sent:* Wednesday, 12 August 2026 15:51:54
> *To:* std-proposals_at_[hidden] <std-proposals_at_[hidden]>
> *Cc:* Udo Steinbach <usenet_at_[hidden]>
> *Subject:* Re: [std-proposals] A new C++ keyword: forget
>
> Again: Benefit?
> I don't see an answer on the most important question.
> --
> Mit Radwegen lernte ich den Menschen kennen. http://radwege.udoline.de/ <http://radwege.udoline.de/>
> GPG: A245 F153 0636 6E34 E2F3 E1EB 817A B14D 3E7E 482E
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals <https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals>
>

Received on 2026-08-13 22:10:40