fork download
  1. #include <iostream>
  2.  
  3. void foo(int k) {
  4. static auto bar = [&]{
  5. std::cout << k << std::endl;
  6. };
  7. bar();
  8. }
  9.  
  10. void baz(int k, int v, int j) {
  11. std::cout << "baz: ";
  12. foo(k);
  13. foo(v);
  14. foo(j);
  15. }
  16.  
  17. int main () {
  18. foo(1); baz(2, 3, 4); foo(3);
  19. }
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
1
baz: 2
2
4
3