   C++ Templates
  I was under the impression that templates in C++ were actually handled at compile time to generate classes as necessary, and yet I've managed to come across something that doesn't work...class Works {  std::map<std::string,int> testMap;    //this doesn't compile, as it shouldn't, since it does nothing  //std::map<std::string,int>::iterator;    //compiles fine  typedef std::map<std::string,int>::iterator TestIterator;};template<typename T>class Broken {  std::map<std::string,T> testMap;    //this compiles, but is completely useless  std::map<std::string,T>::iterator;    //doesn't compile  typedef std::map<std::string,T>::iterator TestIterator;};So here's my question: is it simply due to the fact that you can't use templates within templated classes (and if so, why do vectors work fine?), or is there something wrong with my understanding of templates, or is there something wrong with GCC?   
typedef typename std::map<std::string,T>::iterator TestIterator;Welcome to the depths of name resolution.;  I can't believe it was that simple... Thanks for the help though. Greatly appreciated.   ;  To elaborate slightly; what "iterator" is in "std::map<std::string,T>::iterator" is dependent on what the template parameter T actually is. The compiler can't tell if "iterator" is a type, value, member function, whatever, until the template is instantiated.Therefore, to resolve the ambiguity, you have to explicitly tell the compiler that "iterator" is in fact a type, using typename.   