7

Possible Duplicate:
Why can't templates be declared in a function?

void fun ()
{
  template<typename T> struct InnerClass {};
}

gives errors.

error: expected primary-expression before ‘template’
error: expected ‘;’ before ‘template’

Just wanted to know, WHY ?

Community
  • 1
  • 1
iammilind
  • 68,093
  • 33
  • 169
  • 336
  • Same question: [Why can't templates be declared in a function?](http://stackoverflow.com/questions/3449112/why-cant-templates-be-declared-in-a-function) – Oleg Svechkarenko May 17 '11 at 14:45

0 Answers0