gcc 3.3.2 problem with STL MAP container
Morten.Gulbrandsen
f1000mhz@yahoo.de
Tue Feb 8 15:53:00 GMT 2005
corey taylor wrote:
>Moten,
>
> I think this is *best* explained by the gcc release notes for 3.4
>
> This release is the first one to throw this as an error and not a
>warning as you can produce in gcc 3.3.
>
> http://gcc.gnu.org/gcc-3.4/changes.html
>
> Under C++. The third bullet.
>
> The summary is that you need to explicitly specify that
>const_iterator with the 'typename' keyword before it.
>
>corey
>
>
>
>
Thanks, this should be correct ?
//
// Display map properties
//
template<class T, class A>
void ShowMap(const map<T, A>& v)
{
typename map<T, A>::const_iterator ci;
for ( ci = v.begin(); ci != v.end(); ++ci)
cout << ci->first << ": " << ci->second << "\n";
cout << endl;
}
instead of incorrect :
template<class T, class A>
> void ShowMap(const map<T, A>& v)
> {
> for (map<T, A>::const_iterator ci = v.begin(); // line 107
>
> /*=======================!!=========================*/
>
> ci != v.end(); ++ci)
> cout << ci->first << ": " << ci->second << "\n";
>
> cout << endl;
> }
if this is correct then I have inderstood it,
'typename' was greek to me
best regards
Morten Gulbrandsen
More information about the Gcc-help
mailing list