fork(1) download
  1. #include <functional>
  2. #include <iostream>
  3.  
  4. int main(){
  5. float a=3,b=2;
  6. std::function < float() > multiplyFloat= [a,b]() -> float {return a*b;};
  7.  
  8. int c=4,d=5;
  9. std::function < int() > multiplyInt = [c,d]() -> int {return c*d;};
  10.  
  11. std::cout << multiplyFloat() << " " << multiplyInt() << std::endl;
  12. return 0;
  13. };
Success #stdin #stdout 0s 3028KB
stdin
Standard input is empty
stdout
6 20