The double life of objects
Andrzej's C++ Blog
by Andrzej Krzemieński
4M ago
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 initialization is complete. But this lifetime property of objects becomes ..read more
Visit website
The obvious final step
Andrzej's C++ Blog
by Andrzej Krzemieński
1y ago
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 element ..read more
Visit website
Using std::chrono
Andrzej's C++ Blog
by Andrzej Krzemieński
2y ago
The goal of this post is to show how the <chrono> 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 <chrono> from ..read more
Visit website
Concepts — case studies
Andrzej's C++ Blog
by Andrzej Krzemieński
2y ago
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 1 My concept has two ..read more
Visit website
Decent concepts
Andrzej's C++ Blog
by Andrzej Krzemieński
3y ago
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 in them is not complete. In this post I ..read more
Visit website
Contracts, Preconditions & Invariants
Andrzej's C++ Blog
by Andrzej Krzemieński
3y ago
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 this post are: (1 ..read more
Visit website
Semantic requirements in concepts
Andrzej's C++ Blog
by Andrzej Krzemieński
3y ago
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 not tied to any specific language: it ..read more
Visit website
Reflection for aggregates
Andrzej's C++ Blog
by Andrzej Krzemieński
3y ago
An aggregate is an array or a class with no user-declared or inherited constructors, no private or protected direct non-static data members, no virtual functions, and no virtual, private, or protected base classes. Aggregates can be initialized in aggregate initialization ..read more
Visit website
Concept archetypes — update
Andrzej's C++ Blog
by Andrzej Krzemieński
3y ago
An observant reader indicated that in the previous post where I was trying to implement a concept archetype — a type with minimal interface that models a given concept — I actually failed. This deserves a closer examination. Let’s recall ..read more
Visit website
Concept archetypes
Andrzej's C++ Blog
by Andrzej Krzemieński
3y ago
Concepts in the form added in C++20 used to be called lite. This is because they do not provide one quite important functionality: having the compiler check if the author of a constrained template is only using operations and types ..read more
Visit website

Follow Andrzej's C++ Blog on FeedSpot

Continue with Google
Continue with Apple
OR