parsed as non-type error
Paul Davis
pjdavis@engineering.uiowa.edu
Wed Feb 7 22:01:00 GMT 2007
Hi,
This is just an academic question, but what exactly is causing this error:
test.cc:31: error: dependent-name
'std::map<int,TYPE,std::less<int>,std::allocator<std::pair<const int,
TYPE> > >::iterator' is parsed as a non-type, but instantiation yields
a type
test.cc:31: note: say 'typename
std::map<int,TYPE,std::less<int>,std::allocator<std::pair<const int,
TYPE> > >::iterator' if a type is meant
When trying to compile this function:
template<typename TYPE>
void
printMembers( std::map< int, TYPE > pmap )
{
std::map< int, TYPE >::iterator iter ;
for( iter = pmap.begin() ; iter != pmap.end() ; iter++ )
{
std::cerr << "Key: " << iter->first << " Value: " <<
iter->second << std::endl ;
}
}
The notice made it obvious how to fix, but I haven't been able to find
an actual explanation of what causes the problem.
Thanks,
Paul
More information about the Gcc-help
mailing list