C++0x Concepts - Dead?
BCS
ao at pathlink.com
Thu Jul 16 13:56:20 PDT 2009
Reply to Jarrett,
> I was thinking it'd be more intuitive if constraints - which are more
> general - would be used to implement specialization. That is,
>
> template X(T: A, U: B)
>
> would basically be syntactic sugar for
>
> template X(T) if(is(T: A) && is(U: B))
>
> Then you have only a single system of specialization and constraining
> to worry about. How would "best matching" work? The compiler could
> definitely be smart enough to pick apart the logical expression in the
> constraint,
My thought on this is discard non `is(T:U)` terms and expand the expressions
into a set of simple AND expressions:
- discard any template options where the expression fails
- replace all sub trees other than AND, OR and `is(T:U)` nodes with their
evaluated value.
- expand to disjunctive normal form (http://en.wikipedia.org/wiki/Disjunctive_normal_form)
- discard false disjuncts
- discard negated terms
- treat each disjunct or each template options as it's own specialization
option and apply the current partial ordering rules.
More information about the Digitalmars-d-announce
mailing list