fork download
  1. #include <iostream>
  2. #include <functional>
  3. #include <initializer_list>
  4.  
  5. extern "C" void foo( std::initializer_list<int> init_lst, std::function< void(int) > fn )
  6. { for( const auto& i : init_lst ) fn(i) ; }
  7.  
  8. int main()
  9. {
  10. foo( { 0, 1, 2, 3, 4 }, [] ( int i ) { std::cout << i << ' ' ; } ) ;
  11. }
  12.  
Success #stdin #stdout 0s 3028KB
stdin
Standard input is empty
stdout
0 1 2 3 4