You need a type name:
typename std::map<int, B>::const_iterator itr;
An iterator is a dependent type (B dependent), and when you have this situation, the compiler requires you to specify it using the type name.
There is a reasonable discussion of the problem here .
anon
source
share