I have a template:

```
template<unsigned int N> struct IntN;

template <> struct IntN< 8> {
   typedef uint8_t type;
}; 

template <> struct IntN<16> {
   typedef uint16_t type;
};

```

And in main I initialise and alternate by doing this:

```
IntN< 8>::type c;

```

This seems to work, however, when I store the value inside a variable, it does not and I get the following error:

> 
> error: non-type template argument of type 'int' is not an integral constant expression
> 
> 
> 

Here is an example of the code:

```
template<unsigned int N> struct IntN;

template <> struct IntN< 8> {
  typedef uint8_t type;
};

template <> struct IntN<16> {
   typedef uint16_t type;
};

int main(int argc, char *argv[]) {
int foo = 8;

IntN<foo>::type c;
}

```

Does anyone have any ideas? Thanks