Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::vector<int> foo;
- foo.push_back(0);
- foo.push_back(1);
- foo.push_back(2);
- foo.push_back(3);
- foo.push_back(4);
- struct is_even
- {
- bool operator()(int n)
- {
- return n % 2;
- }
- };
- std::vector<int>::iterator first_odd_number = std::find(foo.begin(), foo.begin() + 2, is_even);
Advertisement
Add Comment
Please, Sign In to add comment