Short-circuiting in logical operations is a very useful and an often used feature: Should cond_a() evaluate to false, cond_b() is guaranteed not to be evaluated. This is useful for two reasons. One…| Andrzej's C++ blog
This post contains quite advanced material. I assume you are already familiar with Concepts Lite. For an overview of what Concepts Lite is, I recommend this proposal. Also, I have found this blog v…| Andrzej's C++ blog
Certain combinations of types and expressions can make a C++ program ill-formed. “Ill-formed” is a term taken from the C++ Standard and it means that a program is not valid, and compile…| Andrzej's C++ blog
1 post published by Andrzej Krzemieński during March 2020| Andrzej's C++ blog
Update. This post in its original form contained incorrect information about the meaning of parentheses inside requires-clauses in section Conjunction and Disjunction. The section has now been chan…| Andrzej's C++ blog
What is the difference between a concept and a type trait? Note that you can create a type trait using a requires-expression: You can also constrain a template with a type trait using a requires-cl…| Andrzej's C++ blog
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 …| Andrzej's C++ blog
Some common knowledge: the lifetime of the object starts when its initialization is complete. Based on this we can get some further expectations: an object becomes const only after its initializati…| Andrzej's C++ blog
C++ aims to be a language for people working close to metal. It offers abstractions that cost no (or minimum) run-time or memory overhead. If you require zero-overhead abstractions, std::initialize…| Andrzej's C++ blog
The title may be misleading, as I had to invent a new short term for the pattern that occurs in the code once in a while. Example first: During the construction of an XML file when you write an ele…| Andrzej's C++ blog
This post is in response to claims, that I have heard number of times, that the semantics of optional’s move operations are wrong: Some people are surprised that the second assert holds: the …| Andrzej's C++ blog
In this post we will see how to solve the task from the previous post, but display the time point in local time instead of system time. The solution is simple and takes only two additional lines (y…| Andrzej's C++ blog
This post has been inspired by the readers’ questions about using concepts to solve real problems. We will have a look at two such problems and see if, and how, concepts can help. Case Study …| Andrzej's C++ blog
Last year I published two posts on writing concepts: Concept Archetypes, Semantic requirements in concepts. Having had some time to reflect upon these posts, I now realize that the model presented …| Andrzej's C++ blog
In this post we will see what a contract is, how preconditions and invariants can be derived from the contract, and how this process can help detect bugs. Two points that I will be stressing in thi…| Andrzej's C++ blog
The word ‘concept’ in the context of C++ generic programming has two meanings. The first is more abstract: it is the notion from the domain of Generic Programming (GP) in general. GP is…| Andrzej's C++ blog
The goal of this post is to show how the library can be used to solve a practical but not that obvious problem. There is a lot of good material in the Internet where one can learn &l…| Andrzej's C++ blog