In D, the compiler can infer a return type for you. Therefore, there is no need to have syntax -> V
auto func(T, U)(T lhs, U rhs) { return lhs + rhs; }
or if you want to be more specific (but it's better to let the compiler figure out the type with auto !)
typeof(T.init + U.init) func(T, U)(T lhs, U rhs) { return lhs + rhs; }
Like C ++, you cannot use typeof(lhs + rhs) in this place.
source share