Hello everyone,


In the Bjarne's book, there is a line of code like this,

Code:
typedef typename A::template rebind <Link>::other Link_alloc;
It means if A is allocator, we can use use to allocate arbitrary type of object instance, said by Bjarne.

I understand this statement, my question is about the grammar. Do we need the template keyword? Why?

I have tested without temlpate keyword, the code still works. Any ideas?

Code:
template <class T1> class  Foo {
public:
	template <class T2> class Goo {
	public:
		typedef T2	GooValueType;
	};
};

int main()
{
	Foo <int>::Goo<char>::GooValueType a1;
	Foo <int>::template Goo<char>::GooValueType a2;
	return 0;
}

thanks in advance,
George