On occasion I\'ve seen some really indecipherable error messages spit out by gcc
when using templates... Specifically, I\'ve had problems where seemingly correc
Consider the code
template somefunction( T * arg )
{
T::sometype x; // broken
.
.
Unfortunately, the compiler is not required to be psychic, and doesn't know whether T::sometype will end up referring to a type name or a static member of T. So, one uses typename
to tell it:
template somefunction( T * arg )
{
typename T::sometype x; // works!
.
.