Prefer the shorthand notation for simple, single-type argument concepts
Reason
Readability. Direct expression of an idea.
Example
To say "T is sortable":
template<typename T> // Correct but verbose: "The parameter is
requires sortable<T> // of type T which is the name of a type
void sort(T&); // that is sortable"
template<sortable T> // Better: "The parameter is of type T
void sort(T&); // which is Sortable"
void sort(sortable auto&); // Best: "The parameter is Sortable"
The shorter versions better match the way we speak. Note that many templates don't need to use the template keyword.
Enforcement
- Not feasible in the short term when people convert from the
<typename T>and<class T> notation. - Later, flag declarations that first introduce a typename and then constrain it with a simple, single-type-argument concept.
T.concepts.def: Concept definition rules
Defining good concepts is non-trivial. Concepts are meant to represent fundamental concepts in an application domain (hence the name "concepts"). Similarly throwing together a set of syntactic constraints to be used for the arguments for a single class or algorithm is not what concepts were designed for and will not give the full benefits of the mechanism.
Obviously, defining concepts is most useful for code that can use an implementation (e.g., C++20 or later) but defining concepts is in itself a useful design technique and helps catch conceptual errors and clean up the concepts (sic!) of an implementation.