C++ functional库里面的boyer_moore_searcher应该怎么用

按照网上的这种写法

#include <string>
#include <algorithm>
#include <iostream>
#include <vector>
#include <functional>
int main()
{

    std::string in = "Lorem ipsum dolor sit amet, consectetur adipiscing elit,"
                     " sed do eiusmod tempor incididunt ut labore et dolore magna aliqua";
    std::string needle = "pisci";
    auto it = std::search(in.begin(), in.end(),
                   std::boyer_moore_searcher(
                       needle.begin(), needle.end()));
    if(it != in.end())
        std::cout << "The string " << needle << " found at offset "
                  << it - in.begin() << '\n';
    else
        std::cout << "The string " << needle << " not found\n";
}

在VS里编写会出现诸如boyer_moore_searcher 未定义标识符,不属于std::,需要模版参数等等。

另一种情况

#pragma warning(disable:4996)
#include <algorithm>
#include <functional>
#include <map>
#include <math.h>
#include <numeric>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string.h>
#include <sstream>
#include <vector>
using namespace std;

int main()
{
    string vec, key;
    boyer_moore_search(vec.begin(), vec.end(), key.begin(), key.end());
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    return 0;
}

这么写的话回出现未定义标识符boyer_moore_search

这个玩意到底怎么写= =

注意是functional头文件里的

https://blog.csdn.net/Explorer_day/article/details/78353195

要在vs里设置为 C++17才行!在项目里单击右键,弹出的菜单选择“属性”---> 配置属性--->C++---->语言---> C++语言标准 下拉框中选择ISO C++17 标准 (/std:c++17),如果你的vs没有该项,请升级vs到2017或以上版本,