On Friday, 31 July 2015 at 14:23:28 UTC, Atila Neves wrote:
On Friday, 31 July 2015 at 11:16:48 UTC, Biotronic wrote:
Why can't another template use the very same concept
information to check if a type implements the concept?
e.g.:
@satisfies!(myConcept, MyStruct)
struct MyStruct { /* ... */ }
void foo(T)(T t) if (check!(myConcept, T))
{ /* ... */ }
Because you want to:
1. Check your type and get sensible error messages
2. Use a constraint in function declarations
It's ok for template constraints to be false without causing a
compilation error; that's how we get compile-time template
function resolution. When you're using something like
`@satisfies` however, you want a compilation error and its
message. That's why you need two things.
Atila
He does have a point. isInputRange!Bar = (checkInputRange!Bar ==
true);