I would like to append a float to a string with the default iostream float format e.g 4.2f the following way:
std::string s;
s.append("float format: ");
s.append(std::to_string((float) 4.3)));
s.append(" : end");
I would like to find a function to generate the following result:
float format: 4.3f : end
But the code above gives me this result instead:
float format: 4.300000000000 : end
I have to format and then put in the string. I don't want to format when pushing on iostream.