C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Canonical State Enforcement

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Thu, 12 Feb 2026 13:33:44 +0100
I think we also discussed in the past some zero-overhead view concept for classes, which enables to have different interfaces. It was possible to do this with current C++. (Zero-overhead, because a view as value just contains the members and the only member is a pointer to the actual class. And the type at compile-time information stores the permissions as type information, either by the type direct or with template parameters as templated type.)   -----Ursprüngliche Nachricht----- Von:Bjorn Reese via Std-Proposals <std-proposals_at_[hidden]> Gesendet:Do 12.02.2026 13:08 Betreff:Re: [std-proposals] Canonical State Enforcement An:mika.koivuranta via Std-Proposals <std-proposals_at_[hidden]>; CC:Bjorn Reese <breese_at_[hidden]>; 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 -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2026-02-12 12:50:43