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

Adrian Matoga via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jan 30 04:01:53 PST 2016


On Friday, 29 January 2016 at 23:44:56 UTC, 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 ^^

Yes, I've seen it, thanks.
Requiring the user to write the constraint might indeed enforce a 
better style, but I want to be able to test it even if the user 
forgets the constraint. Otherwise she'll get cryptic error 
messages from some other code assuming that CallsFoo!NoFoo is a 
valid type.



More information about the Digitalmars-d-learn mailing list