fork(2) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <functional>
  5.  
  6. void find_files(
  7. const std::string& absolute_path,
  8. const std::function<bool(const std::string& filename)> predicate,
  9. std::vector<std::string>& out_files);
  10.  
  11.  
  12. int main() {
  13. std::cout << "Hello World!" << std::endl;
  14. auto is_needle_extension = [](const std::string& filename, const std::vector<std::string>& needle_extensions) -> bool {
  15. return false;
  16. };
  17.  
  18. std::vector<std::string> headers;
  19. find_files("root_folder", [&](const std::string& filename) {
  20. return is_needle_extension(filename, {".h", ".hpp"});
  21. }, headers);
  22.  
  23. auto is_needle = [](const std::string& filename) -> bool { return true; };
  24. find_files("root_folder", is_needle, headers);
  25.  
  26.  
  27. using std::placeholders::_1;
  28. //find_files("root_folder", std::bind(is_needle_extension, _1, {".h", ".hpp"}), headers);
  29.  
  30.  
  31.  
  32. return 0;
  33. }
  34.  
  35. void find_files(
  36. const std::string& absolute_path,
  37. const std::function<bool(const std::string& filename)> predicate,
  38. std::vector<std::string>& out_files) {
  39.  
  40. const std::string filename = "1.txt";
  41. if (predicate(filename)) {
  42. out_files.emplace_back(filename);
  43. }
  44. }
  45.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Hello World!