RAD Studio |  |

E2218: Templates can only be declared at namespace or class scope (C++)

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

For example:

Copy Code

    void func()
    {
      template <class T> myClass {  // Error
        T i;
      };
    }

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!