But with "add" I'm explicitly calling a function.
> There's no reason for the name "+" to be anymore special than "add"
This is debatable. I want "+" to do just an addition.
Also a function "add", depending on the context, can mean different things.
> There's no reason for the name "+" to be anymore special than "add"
This is debatable. I want "+" to do just an addition.
Also a function "add", depending on the context, can mean different things.
For the first case, of course you can create something like:
str1.append(str2);
For the second... I don't know what to say.> framing it as a personal preference
But follow my logic for a moment: if "str3 = str1 + str2" concatenates a string, what "str3 = str1 - str2" should do?
(Yes I know there is no minus operator for std::string)
And "str3 = str1 * str2"?
And "str3 = str1 % str2"?