fork download
  1. #include <iostream>
  2. #include <functional>
  3. using namespace std;
  4.  
  5. void test() {
  6. cout << "test" << endl;
  7. }
  8.  
  9. void call(function<void()> f) {
  10. f();
  11. }
  12.  
  13. int main() {
  14. call(test);
  15. call([]() { cout << "lambda" << endl; });
  16. return 0;
  17. }
Success #stdin #stdout 0s 4440KB
stdin
Standard input is empty
stdout
test
lambda