RAD Studio
ContentsIndex
PreviousUpNext
E2218: Templates can only be declared at namespace or class scope

Templates cannot be declared inside classes or functions. They are only allowed in the global scope, or file level. 

For example:

void func()
{
  template <class T> myClass {  // Error
    T i;
  };
}
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!