I'm having some trouble getting this code to compile on Linux but it works perfectly in Windows.
Windows compiler: Visual Studio 2005
Linux compiler: gcc version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)
class DoSomething
{
public:
template <class DataType>
bool Execute()
{
//do something here
}
};
template <class Operator>
TypeSwitch(int DataTypeCode, Operator& Op)
{
switch (DataTypeCode)
{
case 1: return Op.Execute<char>();
case 2: return Op.Execute<int>();
//snip;
}
}
//To call the operator
TypeSwitch(Code,DoSomething);
In Windows this code works perfectly and does exactly what I want it to. In Linux, I get the errors:
error: expected primary-expression before '>' token
error: expected primary-expression before ')' token
for each of the lines with the case statement.
Any ideas?
Thanks, Mike