fork(1) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. int main() {
  6. int a = 0;
  7. int b = 1;
  8. std::vector<int*> foo;
  9. foo.push_back(&a);
  10. foo.push_back(&b);
  11.  
  12. auto result = std::find_if(foo.begin(), foo.end(),
  13. [] (const int* item) {
  14. return *item == 1;
  15. });
  16.  
  17. if (result != foo.end()) {
  18. std::cout << *result << std::endl;
  19. std::cout << **result << std::endl;
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
0xbfd5d03c
1