Z
zdun777
When I try to compile (g++, ver=4.4.5) this code:
#include <map>
using namespace std;
template<typename T> void fun()
{
map<int, int>::iterator b; //OK
map<T, int>::iterator a; //NOK, error: expected ‘;’ before ‘a’
}
,I get follow compiller error:
error: expected ‘;’ before ‘a’
Can you explain me why I can't define iterator in this way ?
#include <map>
using namespace std;
template<typename T> void fun()
{
map<int, int>::iterator b; //OK
map<T, int>::iterator a; //NOK, error: expected ‘;’ before ‘a’
}
,I get follow compiller error:
error: expected ‘;’ before ‘a’
Can you explain me why I can't define iterator in this way ?