On Mon, 17 Jul 2006, Gennaro Prota wrote: | On Mon, 17 Jul 2006 00:58:47 CST, Gabriel Dos Reis <gdr@cs.tamu.edu> | wrote: | | On Sat, 15 Jul 2006, sashan wrote: | | | Hi | | | | I'm wondering why the std specifies that typename be used in cases like | | this: | | | | typename Foo<T>::bar b2; | | unfortunate limitation of parsing technology that shrines in the | language
On Mon, 17 Jul 2006 00:58:47 CST, Gabriel Dos Reis <gdr@cs.tamu.edu> wrote: On Sat, 15 Jul 2006, sashan wrote: | Hi | | I'm wondering why the std specifies that typename be used in cases like | this: | | typename Foo<T>::bar b2; unfortunate limitation of parsing technology that shrines in the language specification. So it might be made optional in such cases, in the future
On Sat, 15 Jul 2006, James Dennett wrote: | sashan wrote: | Hi | | I'm wondering why the std specifies that typename be used in cases like | this: | | typename Foo<T>::bar b2; | | When bar is a type as opposed to a variable? Why can't the compiler | make that decision? | | Because, assuming T is a dependent type (i.e., a type depending | on a template parameter), it's
sashan wrote: I'm wondering why the std specifies that typename be used in caseslike this: typename Foo<T>::bar b2; When bar is a type as opposed to a variable? Why can't the compiler make that decision? The typename is only needed inside the definition of a template. When the compiler processes the template it doesn't know what type is represented by T (that happens