Does eMbedded Visual C ++ 4.0 (SP4) template function support? I get an error when trying to compile code that works fine in Visual C ++ 6.0.
Here is my template function that compiles:
template<class NodeType>
NodeType* MyFunction()
{
// ... do stuff
return new NodeType("foo"); // return a new class instance of type NodeType
}
Using the template function:
MyClass *myOjb = MyFunction<MyClass>(); // this is causing an error
Compilation errors:
error C2275: 'MyClass' : illegal use of this type as an expression
see declaration of 'MyClass'
error C2059: syntax error : ')'
Is there any compiler I need to change? How do I compile it?
source
share