fork(1) download
  1. #include <iostream>
  2. using namespace std; // consider removing this line in serious projects
  3.  
  4. class T {
  5. public:
  6. double execute(double (*expression)()) {
  7. return expression();
  8. }
  9. };
  10.  
  11. int main() {
  12. T t;
  13. double result = t.execute([]() -> double {return 1 + 1;});
  14. cout << result << endl;
  15.  
  16. return 0;
  17. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
2