Append int to std::string
TL;DR operator+= is a class member function in class string, while operator+ is a template function. The standard class template<typename CharT> basic_string<CharT> has overloaded function basic_string& operator+=(CharT), and string is just basic_string<char>. As values that fits in a lower type can be automatically cast into that type, in expression s += 2, the 2 is … Read more