C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Canonical State Enforcement

From: Bjorn Reese <breese_at_[hidden]>
Date: Thu, 12 Feb 2026 13:08:13 +0100
On 2/11/26 15:49, mika.koivuranta via Std-Proposals wrote:

> Just like there is some state which should never be modified (`const`),
> there is some state which should never be modified non-canonically
> (`canon`). Underlying both of these specifiers is social discipline made
> manifest.

Sounds like you want something that can only be called by some
privileged callers. Beyond access control, we also have friend
declarations for that. There are several idioms that are based on
friendship, such as Passkey [1] or Attorney-Client [2].

[1] https://wg21.link/P2893
[2]
https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Friendship_and_the_Attorney-Client

Received on 2026-02-12 12:08:17