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; }

?

Follow

@namark

I very rarely use c, but if b had been globally scooped outside of the function, wouldn't that change things?

@freemo @pleb

@Pat nah no shenanigans like that, there is difference between the two as written.

@freemo @pleb

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.