Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) nested template closer

 

When template data types are nested, for example a std::vector of std::vectors of int, its declaration ends with its nested template closer.

 

The nested template closer depends on the standard used:

 

 

 

 

 

C++98 nested template closer in the C++98 standard

 

The nested template closer must be '> >', instead of just '>>'.

 

#include <vector>

int main()
{
  std::vector<std::vector<int> > v;
}

 

 

 

 

 

C++11 nested template closer in the C++11 standard

 

 

The nested template closer can be '>>'.

 

#include <vector>

int main()
{
  std::vector<std::vector<int>> v;
}

 

Technical note: this code is compiled successfully using the G++ 4.4.5 compiler, which is supplied with the Qt Creator 2.0.0 IDE.

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict