CppCoreGuidelines
CppCoreGuidelines copied to clipboard
updating the Concepts guidelines to reflect C++20 standard?
May I ask a clarifying question regarding the items in Section T (Templates + Concepts), such as T.13: Prefer the shorthand notation for simple, single-type argument concepts. Is it correct that these examples reflect the proposed syntax in the Concepts TS, which however slightly differs from the syntax ultimately adopted for C++20? For instance, where the Concepts TS allows a short-hand syntax void sort(Sortable &), C++20 will demand void sort(Sortable auto &) to keep the syntactic distinction between the non-template function sort that accepts type Sortable vs. the constrained template function that constrains the type with which it may be instantiated using the Sortable concept. This is based on reading that P1141r1 reflects what was (will be?) accepted into C++20.
If my understanding is correct, then should we expect future updates/clarifications regarding the relationship between the Concepts TS and C++20 Concepts, or perhaps an update to reflect C++20 concepts?
I did read FAQ 9 which makes it clear that the guidelines reflect C++14 + Concepts TS. Still, readers may read section T out of context when trying to learn concepts.
If my understanding is correct,
It is.
then should we expect future updates/clarifications regarding the relationship between the Concepts TS and C++20 Concepts, or perhaps an update to reflect C++20 concepts?
Yes, at the minimum there should be a note mentioning that the C++20 syntax is different.
Editors call: We'll update the Guidelines as a whole for C++20 in the future, but we agree these parts can be updated now... @cubbimew will update these existing parts now to better reflect the upcoming standard.
Note to self; should add "use named concepts" aka "no requires-requires" rule when this is underway.