The 'T'
in the template is just a placeholder for the type used in the function, the class or the entity it is associated with. And the scope of the template parameter ends with the scope of this entity.
See here: When does a template end?
You have to write another template for binary(X x, X y)
as follows:
template< typename X>
X unary(X x)
{
return x*10;
}
template< typename X>
X binary( X x,X y)
{
return x+y;
}
0
solved error: ‘X’ does not name a type X in template functions