我刚刚遇到一个奇怪的错误,它说 find 不是 std 的成员。
错误 C2039:“find”:不是“std”的成员
错误 C3861:“查找”:未找到标识符
基本上,我想查找是否可以在向量中找到字符串
知道为什么会发生这种情况吗?代码帮助告诉我 std 中有 find 方法。
所以这基本上就是我所做的:
#include "OperatorUtil.h"
#include <iostream>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <sstream>
using namespace saeConfig;
namespace operatorUtil
{
bool isIn(const Filter filter, const SearchKey key)
{
bool result = false;
string dimensionStr = key.dimensions.getValue(filter.getFilterKey());
if(filter.getFilterValues().size()>0)
{
vector<string> vstr= filter.getFilterValues();
std::vector<string>::iterator it; // Iterator
it = std::find(vstr.begin(), vstr.end(), dimensionStr); //ERROR LINE
// Check do we have the object in the queue
if(it == vstr.end())
{
result =true;
}
}
return result;
}
}
std::find http://en.cppreference.com/w/cpp/algorithm/find定义在<algorithm>
标头。添加到开头:
#include <algorithm>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)