shadowm

Untitled

Jan 28th, 2016
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. std::vector<int> foo;
  2.  
  3. foo.push_back(0);
  4. foo.push_back(1);
  5. foo.push_back(2);
  6. foo.push_back(3);
  7. foo.push_back(4);
  8.  
  9. struct is_even
  10. {
  11.     bool operator()(int n)
  12.     {
  13.         return n % 2;
  14.     }
  15. };
  16.  
  17. 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