这个错误是什么意思? (errorC2678) 以及如何修复我的代码?

What does this error mean? (errorC2678) and how do I fix my code?

我的 bool 方法应该在保存为私有对象的多维向量中检查字符“-”"sudoku_"。如果找到“-”,则 returns 为真,否则为 returns 假。这真的很简单,所以我不知道为什么会出现此错误:

"error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::vector>' (or there is no acceptable conversion)"

这是我的代码:

bool Grid::checkiffull(){

 string selement = "-";

 if (find(sudoku_.begin(), sudoku_.end(), selement) != sudoku_.end())
      return true;
 else
      return false;
}

编辑:

私有对象定义如下:

vector<vector<string>> sudoku_;

错误显然在 "xutility" 文件的第 3026 行:

template<class _InIt,
class _Ty> inline
_InIt _Find(_InIt _First, _InIt _Last, const _Ty& _Val, false_type)
{   // find first matching _Val
for (; _First != _Last; ++_First)
    if (*_First == _Val)
        break;
return (_First);
}

问题是您的变量是字符串向量的向量:

vector<vector<string>> sudoku_;

当您调用 find 时,您正在搜索 string,因此您应该在简单的 vector<string> 上调用它,而不是在嵌套数据类型上调用它。

所以你必须先在 "external" 向量中找到正确的项目,然后你才能在 "internal" 向量中使用你的代码。