fork(3) download
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <vector>
  4.  
  5. struct Point {
  6. int x, y;
  7. };
  8.  
  9. bool operator==(const Point& left, const Point& right) {
  10. return left.x == right.x && left.y == right.y;
  11. }
  12.  
  13. int main() {
  14. std::vector<Point> v = {
  15. {1, 2},
  16. {3, 4},
  17. {5, 6},
  18. };
  19.  
  20. Point p = {1, 2};
  21. std::cout << "Found? " << (v.end() != std::find(v.begin(), v.end(), p)) << std::endl;
  22. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
Found? 1