Advertisement
frasl

Untitled

Feb 11th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. template<typename... Ts> void func(Ts... args){
  2.     const int size = sizeof...(args) + 2;
  3.     int res[size] = {1,args...,2};
  4.     // since initializer lists guarantee sequencing, this can be used to
  5.     // call a function on each element of a pack, in order:
  6.     int dummy[sizeof...(Ts)] = { (std::cout << args, 0)... };
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement