You can use any function other than the constructor, because then you can change the name of the function, including the template arguments.
Foo foo; foo.Method<T>();
Together with the constructor, the name of the constructor never appears in your expression, so there is no room for explicitly placing the template parameter. You must infer it from the argument.
Foo<T> foo; // no good, assumes the type Foo is a template, not its constructor Foo* pfoo = new Foo<T>(); // same problem Foo foo((T*)0); // ok, deduced Foo* pfoo = new Foo((T*)0); // same
Ben voigt
source share