Possible Duplicate:
Officially, what is typename for?
When I use
template <typename TMap>
typename TMap::referent_type * func(TMap & map, typename TMap::key_type key)
{ ... }
what is the purpose of the two "typename"'s on the second line?
It seems to trigger a compile-time warning (VS2008: C4346) but it's only a "do you claim this to be a type"?
i.e. the actual check if TMap::referent_type
is actually type is made when the template gets instantiated, but there still seems to be a requirement by the C++ standard, but the code being parsed correctly regarless.
Are there any examples where the typename is actually required to resolve an ambiguity? Or is there more to that?