   Templates
  I am trying to follow thinking in c++. I have not yet seen a declaration as such: template<class T> class C<T, double>Can some one please help me understand this?Thanks!//: C05:PartialOrder2.cpp// Reveals partial ordering of class templates.#include <iostream>using namespace std; template<class T, class U> class C {public:  void f() { cout << "Primary Template\n"; }}; template<class U> class C<int, U> {public:  void f() { cout << "T == int\n"; }}; template<class T> class C<T, double> {public:  void f() { cout << "U == double\n”; }}; template<class T, class U> class C<T*, U> {public:  void f() { cout << "T* used\n”; }}; template<class T, class U> class C<T, U*> {public:  void f() { cout << "U* used\n”; }}; template<class T, class U> class C<T*, U*> {public:  void f() { cout << "T* and U* used\n”; }}; template<class T> class C<T, T> {public:  void f() { cout << "T == U\n”; }}; int main() {  C<float, int>().f();    // 1: Primary template  C<int, float>().f();    // 2: T == int  C<float, double>().f(); // 3: U == double  C<float, float>().f();  // 4: T == U  C<float*, float>().f(); // 5: T* used [T is float]  C<float, float*>().f(); // 6: U* used   C&lt;float*, int*&gt;().f();  // 7: T* and U* used [float,int]  // The following are ambiguous://   8: C&lt;int, int&gt;().f();//   9: C&lt;double, double&gt;().f();//  10: C&lt;float*, float*&gt;().f();//  11: C&lt;int, int*&gt;().f();//  12: C&lt;int*, int*&gt;().f();} ///:~</pre>
  template<class T> class C<T, double> is a class template partial specialization. Let me give you an example:template <typename T, unsigned int N>struct MyStaticArray {}; // 0) primary templatetemplate <typename T> struct MyStaticArray<T, 16> {}; // 1) partial specialization for the case where N == 16template <unsigned int N> struct MyStaticArray<bool, N> {}; // 2) partial specialization for the case where T == booltemplate <>struct MyStaticArray<int, 16> {}; // 3) specialization for T=int, N=16// For sake of example, I omitted their definitionsint main () {    MyStaticArray<float,32> w; // invokes the primary template 0)    MyStaticArray<float,16> x; // invokes the partial specialization 1)    MyStaticArray<bool,32768> y; // invokes the partial specialization 2)    MyStaticArray<int,16> z; // invokes the full specialization 3)}For a complete guide, I'd recommend "C++ Templates: The Complete Guide" by Josuttis and Vandevoorde. It is also partially on google-books.   