The following code compiles on gcc, but cannot be executed. I got some
wierd message when executed:
1: Syntax error: ")" unexpected
Is there anything wrong in my function template?
#include <iostream>
using namespace std;
class DDComparePolicy
{
public:
static void Compare ()
{
cout<<"DDComparePolicy "<<endl;
}
};
class TDComparePolicy
{
public:
static void Compare ()
{
cout<<"TDComparePolicy "<<endl;
}
};
template <typename Policy>
void validateField()
{
Policy::Compare ();
}
template <typename Policy>
void validateAllFields()
{
validateField<Policy> ();
}
int main ()
{
string currentRecType ="A";
string lastRecType = "A";
if(currentRecType == "A" && lastRecType == "A")
validateAllFields<DDComparePolicy>();
else if(currentRecType == "T" && lastRecType == "A")
validateAllFields<TDComparePolicy>();
return 0;
}