C++ Core Guidelines: Template Definitions
Template definitions deal with guidelines that are specific to a template implementation. This means, in particular, these rules focus on how a template definition depends on its context.
This author has not written his bio yet.
But we are proud to say that Rainer Grimm contributed 699 entries already.
Template definitions deal with guidelines that are specific to a template implementation. This means, in particular, these rules focus on how a template definition depends on its context.
There is, in particular, one rule left to template interfaces which are quite interesting: T.47: Avoid highly visible unconstrained templates with common names. Admittedly, the rule T47 is often the reason for unexpected behavior because the wrong function is called.
The topic for today is quite important when you create your type: Regular and SemiRegular types.
Last week I was at two conferences in Berlin: Meeting Embedded and Meeting C++. Here are my impressions from both conferences.
This post is about template interfaces 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 also holds 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. The first of the three remaining rules in this post is quite sophisticated.
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.