1#include <iostream>
2#include <vector>
3#include <algorithm>
4using namespace std;
5
6int main()
7{
8 vector<int> myvec {2, 5, 6, 10, 56, 7, 48, 89};
9 vector<int>::iterator gt10 = find_if(myvec.begin(), myvec.end(), [](int x){return x>10;}); // >= C++11
10 cout << "First item > 10: " << *gt10 << endl;
11
12 //check if pointer points to myvec.end()
13 if(gt10 != myvec.end()) {
14 cout << "nf points to: " << *gt10 << endl;
15 }
16 else {
17 cout << "item not found" << endl;
18 }
19
20 return 0;
21}
22