0
template <class F, class... Args>
void for_each_argument(F f, Args&&... args) {
    (void)(int[]){(f(forward<Args>(args)), 0)...};
}

I saw this code somewhere, but how does it turn out to be do f for each in args. What is going on here.

Kozuki
  • 97
  • 8
  • Nowadays you can write `(f(std::forward(args)), ...);` which looks somewhat more sane. – nwp Feb 26 '18 at 14:36
  • @nwp I still can't understand the mechanism there. – Kozuki Feb 26 '18 at 15:03
  • Look up "variadic templates" and "parameter pack expansion". You might need [a book](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list/388282#388282). – nwp Feb 26 '18 at 15:18

0 Answers0