The following simple program will not compile:
#include <map>
2
3 using namespace std;
4 ^M
5 template<class T, class A>
6 void ShowMap(const map<T, A>& v)
7 {
8 map<T, A>::const_iterator ci = v.begin();
9 return;
10
11 }
The compiler produces the following error message;
g++ program.cpp -o Program
2 program.cpp: In function ‘void ShowMap(const std::map<t,>&)’:
3 program.cpp:8:4: error: need ‘typename’ before ‘std::map<t,>::const_iterator’ because ‘std::map<t,>’ is a dependent scope
4 program.cpp:8:30: error: expected ‘;’ before ‘ci’
5 make: *** [Program] Error 1
~
Can anyone explain the problem to me?
Thank you very much
TCNM