Template arguments (C++ only)

There are three kinds of template arguments corresponding to the three types of template parameters:

A template argument must match the type and form specified by the corresponding parameter declared in the template.

To use the default value of a template parameter, you omit the corresponding template argument. However, even if all template parameters have defaults, you still must use the <> brackets. For example, the following will yield a syntax error:

template<class T = int> class X { };
X<> a;
X b;

The last declaration, X b, will yield an error.



[ Top of Page | Previous Page | Next Page | Contents | Index ]