When does the pattern end? Let's look at this code:
template <class T>
class thatClass
{
T a, b;
thatClass (T x, T y) {a = x; b = y;}
};
template <class T>T aFunc(T one, T two)
{
return one+two;
}
So when does it end template <class T>
? Does it always end at the end of a class or function definition, or what? And why can't you use only one template that you specified for both classes and functions, so in this case I could use the template parameter T
for the function aFunc
and for class definition?
user7926026
source
share