Is something like this possible?
// We can even assume T and U are native C++ types
template<typename T, typename U>
magically_deduce_return_type_of(T * U) my_mul() { return T * U; }
Or would somebody have to hack up a return_type struct and specialize it for every pair of native types?
Heard of
decltype?In
C++0xyou can do