0
如何查看向量或向量(ruleList)列中的元素是否存在于名为ntList(不是向量向量)的另一个向量中。我目前有:查找向量的向量元素是否存在于另一个向量中
for(int j = 0; j < ruleList[0].size(); j++)
{
for(int i = 0; i < ntList.size(); i++)
{
if(std::find(ruleList[0][j].begin(), ruleList[0][j].end(), ntList[i]) != ruleList[0][j].end())
{
;
}
else
{
errorList.push_back(ERROR1);
error = true;
}
}
}
我得到一个错误,但我不完全确定为什么。
error C2678: binary '==' : no operator found which takes a left-hand operand of type 'char' (or there is no acceptable conversion).
任何帮助,将不胜感激。载体声明:
vector<string> ntList;
vector< vector<string> > ruleList(100, vector<string> (0, "0"));
“我得到一个错误,”现在我们还没有。 *发布完整的错误*。 – WhozCraig
错误C2678:二进制'==':找不到操作符找到类型为'char'的左侧操作数(或者没有可接受的转换)。如果我将ntList [i]更改为上面的ntList [i] [0],它会编译得很好,但不会提供我想要的输出。 – user3326306
还发布'ruleList'和'ntList'变量的完整声明。并且请更新*问题*,不要只是将它们放在评论中。 – WhozCraig