what's the difference between
template<typename T>
auto add1(const T& a, const T& b)
{ return a + b; }
and
template<typename T>
auto add2(T a, const T& b)
{ return a += b; }
?
@namark Are you asking because you dont know, or as a riddle?
@freemo yes
@namark well my C++ is a little rusty but functionally they should be relatively equivalent as far as I can tell. The second one may be a bit slower as it reassigns a variable with function level scope before returning it (and the scope therefore being dropped)... but aside from the second one being a little inefficient they should behave the same.