11.5 Class Template Parameters

Ru-Brd

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 
Ru-Brd


C++ Templates
C++ Templates: The Complete Guide
ISBN: 0201734842
EAN: 2147483647
Year: 2002
Pages: 185

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net