fork download
  1. #include <iostream>
  2.  
  3. int main(){
  4. struct lambda {
  5. explicit lambda(int i) : i(i) {}
  6. int i;
  7. int operator()() { static int x = 0; x +=4; std::cout << i << " " << x << std::endl; return i; }
  8. };
  9. lambda a(0);
  10. lambda b(1);
  11. a();
  12. b();
  13. char foo[50];
  14. gets(foo);
  15. }
Success #stdin #stdout 0s 2832KB
stdin
Standard input is empty
stdout
0 4
1 8