为什么在使用 将其附加到字符串之前需要显式number 0
转换为?char
string::operator+
using namespace std;
int main()
{
string s = "";
s += 65; // no compile error
s += (char)0; // requires explicit cast
//s += 0; // compile error
return 0;
}
更新澄清:我的目标是将一个字节(包含任何值,包括零)附加到现有的字节数组。