Could anyone tell me why this doesn’t work?
enum CompCriteria{ByKey,ByValue,ByeKeyAndValue};
template<class T>
struct X;
template<>
struct X<CompCriteria>
{
};
int _tmain(int argc, _TCHAR* argv[])
{
X<CompCriteria::ByeKeyAndValue> x;
return 0;
}
You have specialized
Xfor a type, but you’re trying to use it with the integerCompCriteria::ByeKeyAndValue.You can specialize template class for the
enum CompCriteriaunderlying type –intin this case, as follows: