我有一個新的函數removeInelligibleCharsFromTargetName
。函數不允許比較字符串中的單個字符 - C++
void removeInelligibleCharsFromTargetName(string *targetName)
{
for(int i = 0; i < targetName->length(); i++)
{
for(int j = 0; j < ineligibleChars.length(); j++)
{
if(targetName[i] == ineligibleChars[j])
targetName[i] = '_';
}
}
}
問題是,當我嘗試在如果環我得到以下錯誤的比較:
error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::string' (or there is no acceptable conversion) 32> c:\program files\microsoft sdks\windows\v6.0a\include\guiddef.h(192): could be 'int operator ==(const GUID &,const GUID &)' while trying to match the argument list '(std::string, char)'
但是把那個完全相同的嵌套循環回來,我把它而不是調用函數吧工作正常。
有人可以告訴我乳清它不會在一個函數中工作,但可以在函數外正常工作。毫無疑問,它是一個指針,但我不知道是什麼。
我認爲您發現了該錯誤:)。 – 2012-02-03 16:33:47
我真的不知道。週五晚上的晚上是我所有....... 謝謝 – discodowney 2012-02-03 16:35:25