fork download
  1. #include <iostream>
  2. #include <functional>
  3. using namespace std;
  4.  
  5.  
  6.  
  7.  
  8. int main() {
  9. // your code goes here
  10.  
  11. int x = 4;
  12. auto y = [&r = x, x = x+1]()->int {
  13. r += 2;
  14. return x+2;
  15. }();
  16.  
  17. cout << y << endl;
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
7