fork download
  1. #include <iostream>
  2.  
  3. template<typename Fun>
  4. void A(Fun const &f)
  5. {
  6. f(2);
  7. }
  8.  
  9. template<typename Fun>
  10. void B(Fun const &f)
  11. {
  12. f(3);
  13. }
  14.  
  15. template<typename Fun>
  16. void C(Fun const &f)
  17. {
  18. f(42);
  19. }
  20.  
  21. int main(int, char**) noexcept
  22. {
  23. auto Func = [](auto const &v)
  24. {
  25. std::cout << v << '\n';
  26. };
  27.  
  28. A(Func);
  29. B(Func);
  30. C(Func);
  31.  
  32. return 0;
  33. }
Success #stdin #stdout 0s 4368KB
stdin
Standard input is empty
stdout
2
3
42