Could check state when calling redact() and unredact() too
template<class T>
class Redactable {
T value_{};
bool redacted_ = false;
public:
void redact()
pre (!redacted_)
{ redacted_ = true; }
void unredact()
pre (redacted_)
{ redacted_ = false; }
operator T&()
pre (!redacted_)
{
return value_;
}
};
On 24/08/2026 13:07, Sebastian Wittmeier via Std-Proposals wrote:
AW: [std-proposals] Forget forget let's redact Something like
template<class T>
class Redactable {
T value_{};
bool redacted_ = false;
public:
void redact() { redacted_ = true; }
void unredact() { redacted_ = false; }
operator T&()
pre (!redacted_)
{
return value_;
}
};
With the only magic being good error handing by the compiler or IDE?