string& operator+= (const string& str);
When we look at the function prototype, we assume that the string passed into the function won't be changed, right?
However, consider the situation:
string str("Example");
str += str;
The string 'str' was changed, actually. Isn't this kind of scenario considered strange?
Will it be better to change the prototype to?
string& operator+= (string& str);
I have searched lots of sources and examples like this, but it seems normal to most people. There's no one asking about it, or it might be the case that I didn't find one.(Sorry if it's my problem, it's so hard to find the proper keywords for non-native speaker)