D
dawid
Hi, I'm trying to compile this template:
1 #include <set>
2
3 using std::set;
4
5 template <class TYPE>
6 void function(const set<TYPE> &data) {
7 for (set<TYPE>::const_iterator iter = data.begin(); iter !=
data.end(); iter++) {
8 }
9 }
g++ 4.2.3 prints:
g++ temp.cpp -o temp
temp.cpp: In function ‘void function(const std::set<TYPE,
std::less<_Key>, std::allocator<_CharT> >&)’:
temp.cpp:7: error: expected `;' before ‘iter’
temp.cpp:7: error: ‘iter’ was not declared in this scope
make: *** [temp] Error 1
What is wrong ??
regards
1 #include <set>
2
3 using std::set;
4
5 template <class TYPE>
6 void function(const set<TYPE> &data) {
7 for (set<TYPE>::const_iterator iter = data.begin(); iter !=
data.end(); iter++) {
8 }
9 }
g++ 4.2.3 prints:
g++ temp.cpp -o temp
temp.cpp: In function ‘void function(const std::set<TYPE,
std::less<_Key>, std::allocator<_CharT> >&)’:
temp.cpp:7: error: expected `;' before ‘iter’
temp.cpp:7: error: ‘iter’ was not declared in this scope
make: *** [temp] Error 1
What is wrong ??
regards