c++14 - Is this a good way to prepend a char on a string?
08:13 05 Jul 2018

If I wanted to add char c onto the beginning of string s, is the following good practice?

string s = "oo";
char c = 'f';
s = c + s;

In the question "Prepend std::string" on SO the answers that suggested doing this were less well received than the top answer, which suggested using the member-function .insert().

Is there a reason besides efficiency (s = c + s is not efficient since all the contents of string s must be copied)?

c++ string performance c++14