加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – 错误C2039:’find’:不是’std’的成员

发布时间:2020-12-16 03:00:32 所属栏目:百科 来源:网络整理
导读:我刚刚遇到一个奇怪的错误,说发现不是标准的成员. error C2039: ‘find’ : is not a member of ‘std’ error C3861: ‘find’: identifier not found 基本上,我想查找是否可以在向量中找到一个字符串 任何想法为什么会发生这种情况?代码辅助告诉我在std中
我刚刚遇到一个奇怪的错误,说发现不是标准的成员.

error C2039: ‘find’ : is not a member of ‘std’

error C3861: ‘find’: identifier not found

基本上,我想查找是否可以在向量中找到一个字符串

任何想法为什么会发生这种情况?代码辅助告诉我在std中找到方法.

所以这基本上是我做的:

#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在< algorithm>头.添加到开头:
#include <algorithm>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读