This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: const_iterator oddness?


On Wed, 14 Jun 2000, Daniel Berlin wrote:

> I could be wrong, but T isn't really a typename.
> Try "class T".

In template parameter lists, 'class' and 'typename' are synonymous.

> The typename, if anything, is T::const_iterator.

Yes, T::const_iterator needs to be qualified with typename.

> 
> 
> On Wed, 14 Jun 2000, Michael Vance wrote:
> 
> > #include <vector>
> > 
> > template<typename T>
> > void poor_jim( const char* s, const T& p )
> > {
> > 
> >     for( T::const_iterator i = p.begin( ); i != p.end( ); i++ ) {
            ^^
T::const_iterator must be qualified with typename.
> >         cout << *i << endl;
> >     }
> > 
> > }
> > 
> > int main( int argc, char* argv[] )
> > {
> >     return 0;
> > }

by the way, the original question is a general c++ question; it should
  have been sent to comp.lang.c++.moderated or something similar; not to
  gcc@gcc.gnu.org.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]