"Christian Kamm" <kamm-incasoftw...@removethis.de> wrote in message news:h3mh71$185...@digitalmars.com... >> "Walter Bright" <newshou...@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?