我有一个新的函数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