C++ Programming Guide

Nesting Template Declarations

Because the ">>" character sequence is interpreted as the right-shift operator, you must be careful when you use one template declaration inside another. Make sure you separate adjacent ">" characters with at least one blank space.

For example, the following ill-formed statement:


Array<String<10>> short_string_array(100); // >> = right-shift

is interpreted as:


Array<String<10  >> short_string_array(100);

The correct syntax is:


Array<String<10> > short_string_array(100);