Question: > 
> **Possible Duplicate:**  
> 
> [Template instantiation details of GCC and MS compilers](https://stackoverflow.com/questions/7182359/template-instantiation-details-of-gcc-and-ms-compilers) 
> 
> 
> 

1. How does a C++ compiler facilitate template programming? I am interested in knowing the scheme that the compiler follows in template programming.
2. Also, what is/are the difference(s) between typename and class in terms of C++ template?

Answer: 
> 
> How does a C++ compiler facilitate template programming? I am interested in knowing the scheme that the compiler follows in template programming.
> 
> 
> 

templates are actually kept by the compiler as some kind of macro, which is then expanded (the template parts are replaced with given values) upon specialization, applying constraint checking specified in the template.
> 
> Also, what is/are the difference(s) between typename and class in terms of C++ template?
> 
> 
> 

No difference, except when you use template-template parameters:

```
 template <template <typename> class T>
 ...

```

cannot be replaced by 

```
 template <template <typename> typename T>
 //                            ^^^^^^^^ wrong
 ...

```

More in [Templates in c++,typename and class](https://stackoverflow.com/questions/5777137/templates-in-c-typename-and-class).