fork download
  1. #include <algorithm>
  2. #include <iostream>
  3.  
  4. int main()
  5. {
  6. using namespace std;
  7. int a[] = {1, 2, 3, 4, 5};
  8.  
  9. auto const f = [&](){
  10. auto const g = [=](){
  11. for_each(a, a + (sizeof(a) / sizeof(a[0])), [](int i){ cout << i << endl; });
  12. };
  13. g();
  14. };
  15.  
  16. a[0] = 2;
  17.  
  18. f();
  19. }
  20.  
  21.  
Success #stdin #stdout 0s 2828KB
stdin
Standard input is empty
stdout
2
2
3
4
5