#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<int> ivec = { 1, 2, 101, 102, 8, 9, 104};
vector<int> ivec2;
int limit = 100;
copy_if(ivec.begin(), ivec.end(), back_inserter(ivec2),
[limit](int v){return v>limit;});
for_each(ivec2.begin(), ivec2.end(), [](int elem){cout << elem << " "; });
return 0;
}
copy_if() with lambda expression
最新推荐文章于 2022-10-31 18:10:26 发布