The output of the template argument works for any function, including the constructor. But you cannot infer class template parameters from the arguments passed to the constructor. And no, you cannot do this in C ++ 0x.
struct X { template <class T> X(T x) {} }; template <class T> struct Y { Y(T y) {} }; int main() { X x(3);
lock_guard and thread are not class templates. However, they do have constructor templates.
Armen Tsirunyan
source share