小编gee*_*dee的帖子

使用带数组的find_if()时代码段出错

这是我的代码片段:

#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;


bool next(int j)
{
    return(j<3);
}

int main()
{
    ......
    cin>>m;
    int h[m];
    memset(h, 0, sizeof(h));
    .......

    int *p;
    p = find_if(h, h+m, next);
    ......
}
Run Code Online (Sandbox Code Playgroud)

编译时我收到以下错误:

没有用于调用'find_if(int*,int*,)'的匹配函数

template _IIter std :: find_if(_IIter,_IIter,_Predicate)

模板参数扣除/替换失败:

无法推断模板参数'_Predicate'

c++ stl

1
推荐指数
1
解决办法
57
查看次数

标签 统计

c++ ×1

stl ×1