Use of template to disambiguate template names

	class Factory
	{
		// ...
		template<class T> static T* allocate();
	};
	Group<int>*	group =
		Factory::template allocate< Group<int> >();

The keyword template says that the qualified name is a template-id. This is a recent extension and is necessary for syntax analysis of member templates. Without the template keyword, the compiler assumes that name< is a non-template name followed by a less than operator. Consider the following code fragment:

	bool res = Arg::name<1>(2);
Here, name is taken as a (static) data member of Arg and compared less than 1. The boolean result is then compared greater than 2. res therefore gets the value false. In other words, it is parsed as:
	bool res = (Arg::name < 1) > (2);
However, rewritten as:
	bool res = Arg::template name<1>(2);
now name is assumed to be a member template function with an explicitly qualified non-type template argument of 1 which is being called with a function argument of 2, i.e., as if the compiler knew the declaration was:
	class Arg
	{
	  public:
	    template<int N, typename T>
	      static bool name(T t);
	};
This disambiguation is only required inside templates for qualified dependent names, i.e., where the compiler cannot easily establish what the name represents.

See also The Casting Vote: Austin - March '95.