fork(2) download
  1. #include <iostream>
  2.  
  3. auto wrap(int (*f)(int)){
  4. return [f](int i) {
  5. return f(i);
  6. };
  7. }
  8.  
  9. int foo(int i);
  10. extern decltype(wrap(&foo)) wrapped_foo;
  11.  
  12. #if 1
  13. int foo(int i) { return i;}
  14. decltype(wrap(foo)) wrapped_foo = wrap(&foo);
  15. #endif
  16.  
  17. int func(){
  18. return wrapped_foo(42);
  19. }
  20.  
  21.  
  22. int main() {
  23. std::cout << func() << std::endl;
  24. }
Success #stdin #stdout 0s 4268KB
stdin
Standard input is empty
stdout
42