> If you have replace(str, "hello", "world");
> you don't know whether it's changed the value in place or if you're
throwing away a return value. However, if you have
> auto newStr = replace(str, "hello", "world");
> replaceInPlace(newStr, "world", "hello");
> it's quite clear that the first one returns a value and the the
second one does it in place.

Very true. Imho function names would also be more understandable this
way cause xInPlace is unambiguous while xCopy might lead to confusion
(at least I could imagine a stranger misinterpreting replaceCopy etc.)

Reply via email to