Guest User

Untitled

a guest
Nov 28th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. void foo(int i)
  4. {
  5.   std::cout << i << std::endl;
  6. };
  7.  
  8. template<typename T, typename... Types>
  9. void fold_f(T arg, Types... args)
  10. {
  11.   foo(arg);
  12.   if constexpr (sizeof...(args) > 0)
  13.     fold_f(args...);
  14. }
  15.  
  16. int main()
  17. {
  18.   fold_f(1, 2, 7);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment