fork download
  1. #include <iostream>
  2. #include <functional>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6. int f(){ return 9333; }
  7. std::function<int()> g(){ return f; }
  8. int main()
  9. {
  10. auto h = g();
  11. std::cout << h() << std::endl;
  12. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
9333