Class Template Parameters



Class Template Parameters

Template argument deduction applies exclusively to function and member function templates. In particular, the arguments for a class template are not deduced from the arguments to a call of one of its constructors. For example:

template<typename T> 
class S { 
  public: 
    S(T b) : a(b) { 
    } 
  private: 
    T a; 
}; 

S x(12); // ERROR: the class template parameter T is not deduced 
         //        from the constructor call argument 12