When I try and compile the following code...
#include <vector>
template <class T> void DoNothing()
{
std::vector<T>::iterator it;
}
int main(int argc, char**argv)
{
return 0;
}
g++ says:
test.cpp:5: error: expected `;' before ‘it’
And I don't understand why this is a problem. If I replace it with std::vector<int>::iterator
, say, it works fine as expected.
As you can see i'm not instantiating the function, so g++ must have a problem with the template definition itself, but I can't see how its invalid.
Thanks for any advice about whats going on.
NB I'm actually trying to write a templated class and having issues with a map rather than a vector, but this is the simplest test case for my problem.