is(some template instantiation) is true, but the actual instantiation fails

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 29 16:03:49 PST 2016


On 1/29/16 6:44 PM, Basile B. wrote:
>
> Haven't you seen my answer about constraint ?
>
> If you put a constraint on your function template then invalid
> instantiations are rejected. I mean... this language feature is not just
> ornamental...
>
> What do you think constraints are used for otherwise ^^

A constraint should not be necessary here. Constraints are useful when 
you have multiple templates that may match (without specializations), or 
you want to affect the way the compiler reports errors.

Iff a template instantiation T compiles, then is(T) should evaluate to 
true. At least, that's my understanding.

-Steve


More information about the Digitalmars-d-learn mailing list