
On Tue, Oct 2, 2012 at 8:07 AM, Andrew Sutton <asutton.list@gmail.com> wrote:
However, syntactically you use it similarly to a template:
MyConcept<T1, T2, T3>
my_template<T1, T2, T3>
Syntactically yes, but they are allowed to mean very different things.
concept <typename T> EqualityComparable = ... // (3)
Actually, this would make the most sense to me, why wouldn't we use this syntax (3)?
Alex wanted the syntax to reflect, to some extent, the style that he used to define concepts in Elements of Programming. A concept is a type predicate (function) defined by a conjunction of syntactic and semantic requirements. Compare:
// EoP (with pseudo-C++ syntax) Relation(Op) = Predicate(Op) && HomogeneousFunction(Op) && Arity(Op) == 2
// N3351 concept Relation<typename Op, typename T> = Predicate<Op, T, T>;
In the writing, we wanted to emphasize the idea that a concept was "just" a predicate on template arguments. That made it easier to focus on the algorithm's requirements rather than to figure out the extensive set of language rules that would make it work.
But already the fact that the first argument of a concept is automatically replaced with the type when concepts are used in template parameter declarations: template< typename T, Relation<T> Op > void func ( ... ) Already requires to know something special about the language that makes concept work. In any case, why is concept EqualityComparable = ... // (1) concept <typename T> EqualityComparable = ... // (3) concept <typename T> EqualityComparable = ... // (3) --Lorenzo