Whenever the compiler can infer template arguments from function arguments, it's okay to leave them. This is also good practice, as it will make it easier to read the code.
In addition, you can leave the arguments to the end pattern, rather than the beginning or middle:
template<typename T, typename U> void f(T t) {} template<typename T, typename U> void g(U u) {} int main() { f<int>(5);
Zifre
source share