I usually use the +=
operator to add content to an std::string
which is seemingly the same as std::string::append
. There is also the push_back
method for a string which allows to add one character at a time. For now, I always use +=
since it is readable compared to other methods, even if I only want to add one character.
Should I prefer push_back
when I need to append one character only? Are there any performance issues significant enough to use push_back
when adding one character?