fork download
  1. #include <iostream>
  2. #include <functional>
  3. using namespace std;
  4.  
  5. template <typename ReturnType, typename... Args>
  6. auto CallIt( std::function<ReturnType( Args... )> method ) -> std::function<ReturnType( Args... )>
  7. {
  8. return method;
  9. }
  10.  
  11.  
  12.  
  13. int main() {
  14.  
  15. std::function<bool(int,int)> lambda = [] ( int a, int b ) { return a > b; };
  16.  
  17. auto test = CallIt( lambda );
  18. cout << test(4,1);
  19.  
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
1