关于使用字符串比较字符串

nev*_*int 0 c++ string comparison

我尝试使用以下代码在字符串类型下进行字符比较:

vector <int> getQuality(string seedTag, vector <string> &MuTag) { 

    vector <int> Quals;  

     for (unsigned i = 0; i<MuTag.size(); i++) { 
         Quals.push_back(-40);
         cout << MuTag[i] << " " << seedTag[i] << endl;

         if (MuTag[i] == seedTag[i]) { // This line 33 with error
           Quals.push_back(40);
         }


     }

     return Quals;
}
Run Code Online (Sandbox Code Playgroud)

但为什么会出现这样的错误:

 Mycode.cc:33: error: no match for 'operator==' in '(+ MuTag)->std::vector<_Tp, _Alloc>::operator[] [with _Tp = std::string, _Alloc = std::allocator<std::string>](((long unsigned int)i)) == seedTag. std::basic_string<_CharT, _Traits, _Alloc>::operator[] [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>](((long unsigned int)i)
Run Code Online (Sandbox Code Playgroud)

我该如何解决?

Ale*_*yev 7

您正在尝试将字符串(MuTag [i])与char(seedTag [i])进行比较.