fork(1) download
  1. #include <iostream>
  2.  
  3. auto func1(int a, int b) {
  4. struct {
  5. const double& a;
  6. const double& b;
  7. } p = {a, b};
  8.  
  9. return [&p](int x){ return p.a*x + p.b; };
  10.  
  11. }
  12.  
  13. int main() {
  14.  
  15. auto f = func1(10, 20);
  16.  
  17. int c = 9;
  18. int d = 8;
  19.  
  20. std::cout << f(c);
  21. return 0;
  22. }
Runtime error #stdin #stdout 0s 3452KB
stdin
Standard input is empty
stdout
Standard output is empty