const_iterator oddness?
llewelly@dbritsch.dsl.xmission.com
llewelly@dbritsch.dsl.xmission.com
Wed Jun 14 16:49:00 GMT 2000
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.
More information about the Gcc
mailing list