没有可行的重载+ =?

0 c++ overloading vector

有人可以告诉我为什么我收到这个"没有可行的超载"?我很困惑为什么我收到这个....我是一个菜鸟.

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 '+='
        }
    }
Run Code Online (Sandbox Code Playgroud)

Pau*_*ans 7

不是你如何使用std::vector<int>.尝试更像的东西:

temp.push_back(42);
Run Code Online (Sandbox Code Playgroud)

或者你想要一个std::vector<std::string>你可以:

temp.push_back(" ");
Run Code Online (Sandbox Code Playgroud)

但是没有operator +=()定义std::vector.