错误C2039:'find':不是'std'的成员 [英] error C2039: 'find' : is not a member of 'std'

查看:4006
本文介绍了错误C2039:'find':不是'std'的成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚遇到一个奇怪的错误,这说明find不是std的成员。

I just encountered a weird error which saying that find is not a member of std.


错误C2039:'find':is不是'std'的成员

error C2039: 'find' : is not a member of 'std'

错误C3861:找不到标识符

error C3861: 'find': identifier not found

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

Basically, I want to find whether a string can be found in the vector

任何想法为什么会发生这种情况?代码帮助告诉我,在std。

Any idea why does this happen? the code assist tells me that there is find method in std.

中有find方法,所以这基本上是我做的:

so this is basically what I did :

#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;
   }
}


推荐答案

a std :: find 定义在< algorithm> 头。添加到开头:

std::find is defined in the <algorithm> header. Add to the beginning:

#include <algorithm>

这篇关于错误C2039:'find':不是'std'的成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆