links:
http://www.codeproject.com/Articles/257589/An-Idiots-Guide-to-Cplusplus-Templates-Part
http://stackoverflow.com/questions/213121/use-class-or-typename-for-template-parameters

summary:
– delayed declaration/definition materialized upon actual calling of the template function with provided types
– template, typename and class are very much the same, mainly due to historical reason
– compiler would not see if T is correct or not. Only simple checks for basic syntax
– 2 phase template compile: Once for basic syntax checks; and later for each instantiation of function template – where it would perform actual code compilation against the template data-types.

Advertisements