Tuesday, November 23, 2010

Template Declarations

When declaring a template, you can use: tempate <class T> and template <typename T>, but not template <struct T>.

You can pass a struct as a template argument, but the template parameter needs to be declared with either 'class' or 'typename'. Using 'typename' is preferred, because 'class' can be confusing.

No comments:

Post a Comment