0
有人請賜教,我爲什麼收到這個「沒有可行的重載」?我很困惑,爲什麼我收到這個......我是一個菜鳥。無活力重載+ =?
int main()
{
char ch;
vector<int> temp;
ifstream infile;
infile.open("tempsF.txt");
if (infile.fail())
{
cout << "Could not open file numbers." << "\n";
return 1;
}
int data;
infile >> data;
while (!infile.eof())
{
if(isalpha(ch) || ispunct(ch))
{
if(isupper(ch) && ch != '\n')
temp += " ";<<<<<<<<<<<<<<<<<<<<<<<<< No Viable Overloaded '+='
temp += ch;<<<<<<<<<<<<<<<<<<<<<<<<<< No Viable Overloaded '+='
}
}
你甚至希望將一個字符串文字添加到一個整數矢量中去做什麼? – chris 2014-09-27 02:45:55
錯誤消息非常清晰。你正在使用類型爲'vector'和'char [2]'的操作數來執行'+ ='。這些操作數類型沒有'operator + ='重載,因此是錯誤消息。 –
2014-09-27 02:46:02