Question: 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;
}

```

Answer: 
You have specialized `X` for a type, but you're trying to use it with the integer `CompCriteria::ByeKeyAndValue`.

You can specialize template class for the `enum CompCriteria` underlying type - `int` in this case, as follows:

```
enum CompCriteria{ByKey,ByValue,ByeKeyAndValue};

template<int>
struct X;

template<>
struct X<ByeKeyAndValue>
{
};

int main()
{
    X<ByeKeyAndValue> x;
    return 0;
}

```
If you have a `template<class T>` = `template<typename T>`, then T is expected to be, well, a **type**.

`enum CompCriteria` is a type, so you can instantiate that template with it. A single value of the enum, however, is not a type, so you can't.