The folowing code generates a syntax error at the line where the iterator is declared:
template <typename T>
class A
{
public:
struct B
{
int x, y, z;
};
void a()
{
std::map<int, B>::const_iterator itr; // error: ; expected before itr
}
std::vector<T> v;
std::map<int, B> m;
};
This only happens when A is a templated class. What's wrong with this code? If I move B out of A, the code compiles fine.