Can not declare std::map::iterator in template (error: expected `;' before "my_A_iterator")
Erik
sigra@home.se
Thu Jan 17 08:58:00 GMT 2008
I have the strange problem that I can not declare a std::map::iterator
inside a template:
#include <map>
template<typename S> struct A {};
template<typename T> struct B {
typedef A<T> G;
void f(G const & a) {
std::map<G const *, int> my_As;
std::map<G const *, int>::iterator my_A_iterator = my_As.find(&a);
}
};
The compiler says «error: expected `;' before "my_A_iterator"». If I
change A<T> to for example bool, it compiles. What could possibly be
wrong? I tried both g++-4.2.1 and g++-4.2.2.
More information about the Gcc-help
mailing list