Advertisement
Guest User

Untitled

a guest
May 29th, 2015
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #include <cstdio>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. typedef void (*func)();
  6.  
  7. void Func1()
  8. {
  9. std::puts("Func1() called.");
  10. }
  11.  
  12. void Func2()
  13. {
  14. std::puts("Func2() called.");
  15. }
  16.  
  17. int main()
  18. {
  19. std::vector<func> funcs = {Func1, Func2};
  20. auto funcRun = [] (func f) { (*f)(); };
  21.  
  22. for_each(funcs.begin(), funcs.end(), funcRun);
  23.  
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement