What is wrong with the following function template (Other than the fact that it really does almost nothing)?

```
template
int f( int & x )
{
return x;
}
int main()
{
int y = 3, z;
z = f(y);
}
```

There is a rule “Every template argument specified in the template-argument-list must be used in the argument of a function template.” (ARM, page 346.) The most recent C++ Standard provides syntax for instantiating such a template, but the text does not treat this. The Borland compiler complains thus:
```
Borland C++ 5.5 ch16ffnr9.cpp: Error 10: Could not find a match for 'f(int)' in function main()
```

Computer Science & Information Technology

You might also like to view...

When you use a credit card to purchase an item, you are interacting with a CMS.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Which attacker category might have the objective of retaliation against an employer?

A. cybercriminal B. insider C. hactivist D. state-sponsored attacker

Computer Science & Information Technology