On Tuesday, 12 March 2013 at 14:24:11 UTC, TommiT wrote:
The difference is in function overload resolution. Polymorphic concept based template would know about the hierarchical nature of the concepts, say ForwardRange is a sub-concept of InputRange, and thus the function overload resolution would be able to choose the template which has the most derived/specialized concept parameter that still matches with the given template argument.

Example:

void foo(R)(R) if (isInputRange!R) { }
void foo(R)(R) if (isForwardRange!R) { }

int[] arr;
foo(arr); // ambiguity error

// Polymorphic concept to the rescue:

concept InputRange {
    // definition of the concept
    ...
}

// ForwardRange is an extension of InputRange
concept ForwardRange : InputRange {
    ...
}

void bar(InputRange R)(R) { }
void bar(ForwardRange R)(R) { }

int[] arr;
bar(arr); // calls the second one

Reply via email to