fork download
  1. #include <wheels/type_traits.h++>
  2. #include <iostream>
  3. #include <utility>
  4.  
  5. template <typename Fun,
  6. wheels::EnableIf<wheels::is_callable<Fun, void(int, int)>> = wheels::_>
  7. void run(int a, Fun&& f) {
  8. std::forward<Fun>(f)(a, a);
  9. }
  10.  
  11.  
  12. template <typename Fun,
  13. wheels::EnableIf<wheels::is_callable<Fun, void(int)>> = _>
  14. void run(int a, Fun&& f) {
  15. std::forward<Fun>(f)(a);
  16. }
  17.  
  18. int main() {
  19. run(34,[] (int i, int j) { std::cout << i << j << std::endl; });
  20. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty