A new Thread with C++20: std::jthread
One of the participants in my CppCon 2018 workshop asked me: “Can a std::thread be interrupted?”. No, that was my answer, but this is not correct anymore. With C++20, we might get a std::jthread.
This author has not written his bio yet.
But we are proud to say that Rainer Grimm contributed 691 entries already.
One of the participants in my CppCon 2018 workshop asked me: “Can a std::thread be interrupted?”. No, that was my answer, but this is not correct anymore. With C++20, we might get a std::jthread.
Although rule T.11 states: Whenever possible, use standard concepts you sometimes have to define your concepts. This post gives you rules to do it.
We will get concepts with high probability in C++20. Here are the rules from the C++ core guidelines to use them.
This was the first time I was at the CppCon, and it was an overwhelming experience for me.
Concepts revolutionize the way we think about and use generic programming. They didn’t make it in C++11 or C++17 but with C++20, we will get them with a high probability.
In the last post C++ Core Guidelines: Type Erasure, I presented two ways to implement type erasure: void pointers and object orientation. In this post, I bridge dynamic polymorphism (object orientation) with static polymorphism (templates) to get type erasure with templates.
The rule “T.5: Combine generic and OO techniques to amplify their strengths, not their costs” of the core guidelines to generic programming uses type erasure as an example. Type erasure? Really! Of course, it takes me two posts to explain this advanced template technique.
I this post I give an introduction to the rules for generic programming in C++. Generic programming is, from my point of view, the outstanding feature and the future of C++. Hence it follows that this and the upcoming posts are about the future of C++.
Making objects or methods const has two benefits. First, the compiler will complain when you break the contract. Second, you tell the user of the interface that the function will not modify the arguments.
I have prepared the pdf bundle. To get it is quite simple.