Error with stl
Michael Tomuschat
michael.tomuschat@planet-interkom.de
Fri Mar 17 15:27:00 GMT 2006
Hello,
I've got a problem compiling the following source
michael@querx:~/tmp/xxx> g++ -Wall -O2 b.cpp
b.cpp: In member function ‘void bCls<T>::DumpItems()’:
b.cpp:15: error: expected `;' before ‘aIter’
When I compile this code with borland's bcc it compiles without complaining.
So I think it might be an error in g++ or it's because I just start
programming in C++.
Hope You can help me, sicerely
Michael Tomuschat
Here is the code:
# File b.cpp
#include <vector>
using std::vector;
template <class T> struct aCls {
T val;
aCls( T v) { val = v; }
};
template <class T> class bCls {
public:
bCls( void) {}
vector <struct aCls<T> > bLst;
void AddItem( T v) { bLst.insert( bLst.end(), v); }
void DumpItems( void) {
vector<class aCls< T> >::iterator aIter; // ???? tut nicht ????
}
};
int main( void) {
bCls<int> B;
for( int i = 0; i < 10; i++) B.AddItem( i);
return -1;
}
I'm using gcc:
michael@querx:~/tmp/xxx> g++ --version
g++ (GCC) 4.0.2 20050901 (prerelease) (SUSE Linux)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--
Dipl. Ing. Michael Tomuschat
Ing.-Büro Tomuschat Tel. : 07071-943866
Steinbößstr. 23 Fax : 07071-943867 (wenn Büro besetzt ist)
72074 Tübingen E-mail: michael.tomuschat@planet-interkom.de
More information about the Gcc-bugs
mailing list