CppCoreGuidelines icon indicating copy to clipboard operation
CppCoreGuidelines copied to clipboard

updating the Concepts guidelines to reflect C++20 standard?

Open godmar opened this issue 5 years ago • 3 comments

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.

godmar avatar Dec 05 '19 15:12 godmar

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.

jwakely avatar Dec 06 '19 15:12 jwakely

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.

hsutter avatar Sep 03 '20 18:09 hsutter

Note to self; should add "use named concepts" aka "no requires-requires" rule when this is underway.

cubbimew avatar Aug 23 '21 14:08 cubbimew