typename error
Now i have something like
1 2 3 4 5 6
|
template <class T> class A
{
public:
typename map<int,T*>::iterator Iterator;
Iterator func(){};
};
|
This code gives syntax error "missing ';' before identifier 'func'"
What is wrong with it?
Iterator is a variable. That's like doing this:
1 2
|
int myvar;
myvar function(); // <- nonsense
|
I think you meant to typedef it:
1 2
|
typedef typename map<int,T*>::iterator Iterator;
Iterator func(); // <- now this will work
|
Last edited on
Oh finally.. First i did something like;
typedef map<int,T*>::iterator Iterator;
but VS2010 said i should use typename... Thanks!
Topic archived. No new replies allowed.