+ 5
More information on Templates in C++
So, I've been understanding templates in C++, but one thing I don't understand is why you have to call a new template for each new function or class, isn't there a way for a global template??
1 ответ
0
you have to have
template <class d>
over the class
and that over every member function of the classes implementation as well so
template <class d>
void myClass<d>::myFunc(){}
its just the way the syntax works.... nothing you can do about it.
hooe this helps