Windows CE的eMbedded Visual C ++ 4.0中的模板功能

问题描述

| eMbedded Visual C ++ 4.0(SP4)是否支持模板功能?当我尝试编译在Visual C ++ 6.0中可以正常工作的代码时,出现错误。 这是我的模板函数,它会进行编译:
template<class NodeType>
NodeType* MyFunction()
{
    // ... do stuff
    return new NodeType(\"foo\"); // return a new class instance of type NodeType
}
模板功能用法
MyClass *myOjb = MyFunction<MyClass>(); // this is causing an error
编译错误
error C2275: \'MyClass\' : illegal use of this type as an expression
                         see declaration of \'MyClass\'
error C2059: Syntax error : \')\'
我需要更改一些编译器开关吗?我该如何进行编译?     

解决方法

在这里找到答案。 \“当模板函数不是类成员时,它可以正常工作。哦,好吧,我想我会 将其保留为全局功能。\“