Parameter specialization
Eyyub
eyyub.pangearaion at gmail.com
Fri Jul 20 18:47:36 PDT 2012
Hello,
I have a question about the semantic of parameter
specialization(TemplateTypeParameterSpecialization)
In this following code, there are 2 forms of the same function
'add' :
<code>
T add(T, U : T) (T a, U b) //doesn't work
{
return a + b;
}
T add(T, U) (T a, U b) if(is(U : T)) //works
{
return a + b;
}
void main()
{
assert(add(2, cast(short)2) == 4);
}
</code>
So, I infer that, in this case,
TemplateTypeParameterSpecialization and TypeSpecialization(of
IsExpression) aren't semantically equal ? What are differences
between this 2 forms ?
Eyyub,
(I hope that I have an english a bit compréhensible)
More information about the Digitalmars-d-learn
mailing list