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

家住魔仙堡 提交于 2020-01-03 07:25:09

问题


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

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

error C3861: 'find': identifier not found

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

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

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

回答1:


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

#include <algorithm>


来源:https://stackoverflow.com/questions/9868003/error-c2039-find-is-not-a-member-of-std

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!