This post is about template interfaces which are due to the C++ core guidelines: "...a critical concept", because a template interface is "a contract between a user and an implementer - and should be carefully designed.".
An interface is a contract between a user and an implementer and should, therefore, be written with great care. This holds also true if you pass an operation as an argument.
Based on my book "The C++ Standard Library" educative.io created an interactive course. You can have it now at a discount.
"C++ Standard Library including C++14 & C++17" is a interactive journey through the current C++ standard Library.
Let me continue with the rules for defining concepts in the guidelines. In this post, the first of the three remaining rules is quite sophisticated.
One of the participants in my CppCon 2018 workshop asked me: "Can a std::thread be interrupted?". No, 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 from the C++ core guidelines the rules to use them.
This was the first time I was at the CppCon, and it was an overwhelming experience for me.
Concepts revolutionise 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 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.
Currently are 103 guests and no members online
Kubik-Rubik Joomla! Extensions