Template problem

From: Daniel Lidström (someone_at_microsoft.com)
Date: 01/19/04


Date: Mon, 19 Jan 2004 22:47:16 +0100

Hi,

is there anything wrong with this template function?
template<class T>
void print_percents(std::ostream& stream, int n, T vals)
{
  if( !vals.empty() ) {
    T::iterator it = vals.begin();
    stream << (*it).first << '/' << int(100*((*it).second / n)) << '%';
    for( ++ it; it!=vals.end(); ++ it )
      stream << ' ' << (*it).first << '/' << int(100*((*it).second / n)) <<
'%';
    stream << '\n';
  }
}

I can compile it with VC6 but gcc 2.95-3 gives this error:
.src/Hash.h: In function `void print_percents(ostream &, int, T)':
.src/Hash.h:68: parse error before `='
I.e. the line `T::iterator it = vals.begin();'
What's going on?
Thanks!

-- 
Daniel