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

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

@freemo @pleb

Follow

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

@freemo @pleb

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.