Class Invariants -- Andrzej Krzemieński
This article explores the concept of class invariants in C++ and their significance in maintaining code integrity and abstraction. It highlights the difference between struct and class definitions and discusses the role of class invariants in guaranteeing the correctness of class objects. The article also touches upon the trade-offs between strong and weak invariants and provides insights into when to define a new class with proper invariants.
Class Invariants
by Andrzej Krzemieński
From the article:
The primary motivation for defining a class in C++ is to reflect and maintain a class invariant. In this post we will see what class invariants are and how you deal with them. Class invariants are important part of C++, even though there is no “invariant” keyword in C++.
Contrast the following two class definitions:
struct Point { int x; int y; };class Range { int _min; int _max; public: // ... };In C++ a
structis practically aclassbut with a different default member access. The first is an aggregate: it only allows two pieces of data to travel together. If it was not for the nice member names, we might have as well usedstd::pair<int, int>instead.

A new episode of the series about SObjectizer and message passing:
In this post, Victor talks about bringing compile times of the {fmt} library on par with the C standard I/O library (stdio).
Seastar announces that now that C++23 is available, they will support C++23 and C++20 (dropping support for C++17) in accordance with their support policy
In this software troubleshooting case, a customer experienced program crashes, and a detailed analysis of the code revealed several issues. The primary problem stemmed from lazy initialization of a widget list, leading to inconsistent vector states and potential crashes. Additionally, a multithreading issue was identified, highlighting the importance of thread-safety mechanisms in code that can be accessed concurrently.
A new episode of the series about SObjectizer and message passing: