It's also worth going through
this section[
^] on MSDN. I think the biggest mistake with templates was allowing the use of the
class
keyword to define a type (rather than
typename
) as in:
Template < class T >
class MyClass
{
T myVar;
...
where
< class T >
actually means that
T
is a placeholder which will be replaced by a real type when a real class is built from the template such as:
MyClass<int> mc;
where all occurrences of
T
will be replaced by
int<code>
.