C++0x Concepts - Dead?

Nick Sabalausky a at a.a
Thu Jul 16 03:15:17 PDT 2009


"Christian Kamm" <kamm-incasoftware at removethis.de> wrote in message 
news:h3mh71$185a$2 at digitalmars.com...
>> "Walter Bright" <newshound1 at digitalmars.com> wrote in message
>>> Yes. Constraints determine the list of candidate template declarations,
>>> but do not participate in the partial ordering of candidates to 
>>> determine
>>> the 'best' match.
>
> Nick Sabalausky wrote:
>> Pardon my ignorance, but...umm...what?
>
> Example:
>
> class C {}
>
> void foo(T)() if(is(T : Object)) {}
> void foo(T)() if(is(T : C)) {}
>
> void bar(T : Object)() {}
> void bar(T : C)() {}
>
> void main() {
>  foo!(C)(); // error: ambiguous, (both are candidate, no ordering)
>  bar!(C)(); // ok, (both are candidate, second bar more specialized)
> }
>

Well then it seems like the constraints version is both less useful and more 
verbose. Hmm, but I guess it does allow "match/not-match" to be determined 
by arbitrary compile-time expressions. Is there another benefit to the 
constraints that I'm missing?




More information about the Digitalmars-d-announce mailing list