fork download
  1. #include <iostream>
  2.  
  3. struct A
  4. {
  5. template< typename FN, typename... ARGS >
  6. static void call( FN fn, ARGS... args ) { fn(args...) ; }
  7. };
  8.  
  9. void foo( int a ) { std::cout << "foo(" << a << ")\n" ; }
  10.  
  11. int main()
  12. {
  13. A::call( foo, 1 ) ;
  14.  
  15. const auto bar = [] ( int a, double b )
  16. { std::cout << "main::bar(" << a << ',' << b << ")\n" ; } ;
  17.  
  18. A::call( bar, 2, 3.4 ) ;
  19. }
  20.  
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
foo(1)
main::bar(2,3.4)