Tag Archives: C++20
Local Time
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 (you can scroll … Continue reading
Using std::chrono
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, … Continue reading
Concepts — case studies
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 … Continue reading
Decent concepts
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 … Continue reading
Semantic requirements in concepts
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 … Continue reading
Concept archetypes — update
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.
Concept archetypes
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 … Continue reading
Ordering by constraints
In the previous post we have seen how constraint conjunction and disjunction works, and how a function template with constraints is a better match than a function template without constraints (provided that the constraints are satisfied) when determining the best … Continue reading
Requires-clause — updated
The previous post, “Requires-clause”, contained incorrect information about parentheses inside a requires-clause. Token || inside parentheses is still interpretted as a disjunction of two constraints. I apologize for misleading the readers. I also want to thank James Pfeffer for bringing … Continue reading