Possible duplicate:
C ++ template type inference for class vs Function?
When calling a template function, you do not need to specify template parameters if they are not ambiguous from your parameters. For instance. for:
template<typename T> T foo(T a) { }
You can just call foo(1)and it will work, it should not be foo<int>(1).
This does not apply to classes / structures, even if it would be clear from the constructor parameters. For instance:
template<typename T> struct Foo { Foo(T a) { } };
Now I can not do just do_something_with(Foo(1))what it should be do_something_with(Foo<int>(1)).
Often, to get around this problem, there are only a few simple wrapper functions that basically just complete the constructor. This is even in STL: std::make_pair- such an example.
Now the question is: why? Is there a reasonable reason?