   template class member, compilation prob
  hi guys,I don't know if I am wrong, or the vc++2005 compiler is broken, but this code does not compile:template <typename T>class One{public:class Two{public:Two get();};Two getagain();};//does not compiletemplate <typename T>One<T>::Two One<T>::Two::get(){return Two();};//does not compile eitherOne<T>::Two One<T>::getagain(){return Two();};if on the other hand I change the return value of get() and getagain() to int, it works just fine.anybody know what might be the problem here?   
template <typename T>typename One<T>::Two One<T>::Two::get(){return Two();};;  but where is the logic in this???   ;  In the template expression, One<T> is a dependent type. Therefore to resolve One<T>::Two as a type instead of a value, you need to use the typename keyword.   ;  For general T, One<T>::Two is a nested class name.However, because templates can be specialized, there could exist some T for which that's not true. It doesn't even have to be a type. For example, you could specialize One<int> such that One<int>::Two is a float data member.To prevent you from discovering this problem later when you try to instantiate One<int> without having first specialized or otherwise dealt with One<int>::get() (so as to provide a valid return type), the compiler requires you to be explicit up front. The standard didn't used to require that, but now it does. I'm not really sure why that's any help to the compiler anyway (it would still have to reject the code somewhere along the line, and I don't see that you could get a significantly improved error message), but there you go. Truth is stranger than fiction...   ;  It allows syntactic checking of the template definition at point of template definition rather than template instantiation. This in turn allows much more easily deciphered error messages. (If you spent any time working with pre-standard compilers' template code generation, you know what I'm talking about.)   