In specific cases you could always do like std::make_pair
:
template<class T>
make_foo(T val) {
return foo<T>(val);
}
EDIT: I just found the following in “The C++ Programming Language, Third Edition”, page 335. Bjarne says:
Note that class template arguments are
never deduced. The reason is that the
flexibility provided by several
constructors for a class would make
such deduction impossible in many
cases and obscure in many more.
This is of course very subjective. There’s been some discussion about this in comp.std.c++
and the consensus seems to be that there’s no reason why it couldn’t be supported. Whether it would be a good idea or not is another question…