我刚刚遇到一个奇怪的错误,说find不是std的成员.
错误C2039:'find':不是'std'的成员
错误C3861:'find':找不到标识符
基本上,我想找出是否可以在向量中找到字符串
知道为什么会这样吗?代码辅助告诉我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;
}
}
Run Code Online (Sandbox Code Playgroud)
Raf*_*cki 31
std::find在<algorithm>标题中定义.添加到开头:
#include <algorithm>
Run Code Online (Sandbox Code Playgroud)