Oracle® Solaris Studio 12.4: C++ User's Guide

Exit Print View

Updated: March 2015
 
 

6.7.5 Nesting Template Names

Because the “>>” character sequence is interpreted as the right-shift operator, you must be careful when you use one template name 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);