I really don't get why it has to take so much to make such a little function. Here's what I have.
template <typename A, typename B> auto add(A a, B b) -> decltype(a + b) {
return a + b;
}
Is there a way to shrink this code while maintaining its ability to take different arguments? For a comparison, here is it in Python; there is a big difference between the two.
def add(a, b):
return a + b
operator +
. Without the declytype it would be infinitely long as you need to declare one for each combination. \$\endgroup\$