Boost logo

Boost :

Subject: Re: [boost] [contract] toward N3351 concepts
From: Andrew Sutton (asutton.list_at_[hidden])
Date: 2012-10-02 13:49:22


> In any case, why is (2) better than (3)? What was the rationale for
> such a syntax in Elements of Programming? (At the end I can adopt
> whatever syntax but I will need to justify the choice in a "rationale"
> section.)
>
> template< typename T >
> concept EqualityComparable = ... // (1) no good because concepts
> are not templates
>
> concept EqualityComparable< typename T > = ... // (2)
>
> concept <typename T> EqualityComparable = ... // (3)

I really can't say where the concept syntax in EoP came from, but the
notation is traditionally mathematical.

If you buy into the idea that a concept is a function on template
arguments, then I think that 2 fits with existing C++ syntax better
than 3. After all, we don't write the type of functions ahead of their
declarator. That is we don't declare min() as "T (T, T) min", where "T
(T, T)" is the function type of min.

I tend to prefer 2. It seems more consistent with existing syntax.

Andrew


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk